Javascript Literals
- Function Literals
var squares = function(x){ return x*x; }
var square = new Function("x", "return x*x;");Object Literals
var point = new Object({x:2.3, y:-1.2});var point = {x:2.3, y:-1.2};
var point = new Object({x:2.3, y:-1.2});
Array Literalsvar a = [1.2, "Javascript", true, {x:1, y:3}];
var a = new Array(1.2, "Javascript", true, {x:1, y:3});
沒有留言:
張貼留言