菲彩国际

Archive for the ‘前端開發’ Category

逐句學英文-對象

Objects??bd?ikt對象

An object is a collection of named values.
菲彩国际 對象是已命名的數據的集合。

These named values are usually referred to as properties of the object.
菲彩国际 這些已命名的數據通常被作為對象的屬性來引用。

For example, if an object named image has properties named width and height, you can refer to those properties like this:
菲彩国际 例如,如果一個名為image的對象有一個名為width和一個名為height的屬性,我們可以使用如下方式來引用這些屬性:

image.width
image.height

Properties of objects are, in many ways, just like JavaScript variables; they can contain any type of data, including arrays, functions, and other objects.
對象的屬性在很多方面都跟 JavaScript 的變量相似,屬性可以是任何類型的數據,包括數組、函數和其他對象。

Thus, you might see JavaScript code like this:
所以,讀者有可能會見到如下的 JavaScript代碼:
document.myform.button

This code refers to the button property of an object that is itself stored in the myform property of an object named document.
這里引用了一個對象的button屬性,而這個對象本身又存儲在對象document的myform屬性中。

When a function value is stored in a property of an object, that function is often called a method, and the property name becomes the method name.
如果一個函數值是存儲在某個對象的屬性中的,那么那個函數通常被稱為方法,屬性名也就變成了方法名。

Objects in JavaScript can serve as associative arrays; that is, they can associate arbitrary data values with arbitrary strings.
菲彩国际 JavaScript 中的對象可以作為關聯詞組使用,因為它們能夠將任意的數據值和任意的字符串關聯起來。

閱讀全文 »

逐句學英文-函數

Functions?f??k??n函數

Although a function is defined only once, a JavaScript program can execute or invoke it any number of times.
雖然函數只定義一次,但是JavaScript程序卻可以多次執行或調用它。

A function may be passed arguments, or parameters, specifying the value or values upon which it is to perform its computation, and it may also return a value that represents the results of that computation.
菲彩国际 函數可以帶有實際參數或形式參數,用于指定這個函數執行計算要使用的一個或多個值,而且它還能返回一個值,以表示計算結果。

JavaScript implementations provide many predefined functions, such as the Math.sin() function that computes the sine of an angle.
JavaScript 的實現提供了許多預定義函數,如 Math.sin() ,它用于計算角的正弦值。

JavaScript programs may also define their own functions with code that looks like this:
JavaScript 程序也可以定義自己的函數,代碼如下:

function square(x)//定義了一個名為square的函數,它指定了一個參數x
{
 
return x*x; // 返回參數x的平方(值)
}

Once a function is defined, you can invoke it by following the function’s name with an optional comma-separated list of arguments within parentheses. The following lines are function invocations:
一旦定義了函數,只需要在函數名后邊加上一個可選的、用逗號分隔的參數列表(該列表用括號括起來),就可以調用它。下面是函數調用的代碼:

y = Math.sin(x);
y = square(x);
d = compute_distance(x1,y1,z1,x2,y2,z2);
move();

An important feature of JavaScript is that functions are values that can be manipulated by JavaScript code.
菲彩国际 JavaScript 的一個重要特性是 JavaScript 代碼可以對函數進行操作。

The fact that functions are true values in JavaScript gives a lot of flexibility to the language.
菲彩国际 JavaScript 中的函數是真正的數值,這一點給語言帶來了很大的靈活性。

It means that functions can be stored in variables, arrays, and objects, and it means that functions can be passed as arguments to other functions.
菲彩国际 這就意味著函數可以被存儲在變量、數組和對象中,而且函數還可以作為參數傳遞給其他函數。

閱讀全文 »

逐句學英文-布爾值

Boolean Values?bu:li:?n布爾值

The boolean datatype has two values, these are represented by the literals true and false.
菲彩国际 布爾數據類型有2個值,分別由直接量true和false表示。

Boolean values are generally the result of comparisons you make in your JavaScript programs. For example:
菲彩国际 布爾值通常在JavaScript程序中比較所得的結果。例如:

a == 4

This code tests to see whether the value of the variable a is equal to the number 4.
菲彩国际 這行代碼檢測了變量a的值是否和數值4相等。

If it is, the result of this comparison is the boolean value true.
如果相等,比較的結果就是布爾值true

If a is not equal to 4, the result of the comparison is false.
菲彩国际 如果a不等于4,比較的結果就是false

Boolean values are typically used in JavaScript control structures.
布爾值通常用于JavaScript的控制結構。

For example, the if/else statement in JavaScript performs one action if a boolean value is true and another action if the value is false.
菲彩国际 例如,JavaScript的 if/else 語句,就是在布爾值為true時,執行一個動作,而在布爾值為false時,執行另一個動作。

if (a == 4)
 
b = b + 1;
else
 
a = a + 1;

This code checks whether a equals 4. If so, it adds 1 to b; otherwise, it adds 1 to a.
這段代碼檢測了a是否等于4,如果是,就給b增加1,否則給a加1

閱讀全文 »

逐句學英文-字符串

Stringsstri?字符串

A string is a sequence of Unicode letters, digits, punctuation characters, and so on; it is the JavaScript datatype for representing text.
菲彩国际 字符串是由Unicode字符、數字、標點符號等組成的序列,它是JavaScript用來表示文本的數據類型。

To represent a single character, you simply use a string that has a length of 1.
要表示單個字符,必須使用長度為1的字符串。

閱讀全文 »

Page 5 of 17? First...34567...10...Last ?
崔凱博客
Powered by | Theme by ck web design | TOP 頂部
Copyright ? 崔凱 All rights reserved. 蜀ICP備12025891號.
菲彩国际_菲彩国际官网_Welcome 紫金阁棋牌-紫金阁棋牌官网 紫金阁棋牌-紫金阁棋牌官网 紫金阁棋牌-紫金阁棋牌官网 紫金阁棋牌-紫金阁棋牌官网