2014年11月22日 星期六

javascript 學習

onfirm 彈出視窗
prompt 彈出視窗並有input欄位

Code:

1. ( ): control order of operations
2. * and /: multiplication and division
3. - and +: subtraction and addition


modulo%
23 % 10 = 2

Substring:

"some word".substring(xy) where x is where you start chopping and y is where you finish chopping the original string.
The number part is a little strange. To select for the "he" in "hello", you would write this:
"hello". substring(0, 2);
Each character in a string is numbered starting from 0, like this:
0 1 2 3 4
 | | | | | 
 h e l l o
The letter h is in position 0, the letter e is in position 1, and so on.

Therefore if you start at position 0, and slice right up till position 2, you are left with just he

ex:
第4個字到第7個字
"put some string".substring(3,7);
ex:
console.log("January".substring(0,3));
console.log("Melbourne is great".substring(0,12));

console.log("Hamburgers".substring(3,10));
Jan
Melbourne is

burgers

javascript資源


線上學習好書Eloquent JavaScript

http://eloquentjavascript.net/


深入淺出 JavaScript

深入淺出 JavaScript

http://www.books.com.tw/products/0010494235