慕慕森
2019-08-02 14:02:16
‘:’(冒號)在JavaScript中做什么?我正在學習JavaScript,在瀏覽jQuery庫時我看到了:(冒號)經(jīng)常使用。這在JavaScript中是用來做什么的?// Return an array of filtered elements (r)// and the modified expression string (t) return { r: r, t: t };
3 回答

HUX布斯
TA貢獻1876條經(jīng)驗 獲得超6個贊
var o = { r: 'some value', t: 'some other value'};
var o = new Object();o.r = 'some value';o.t = 'some other value';

富國滬深
TA貢獻1790條經(jīng)驗 獲得超9個贊
var i = 100, j = 100;outerloop:while(i>0) { while(j>0) { j++ if(j>50) { break outerloop; } }i++}

牧羊人nacy
TA貢獻1862條經(jīng)驗 獲得超7個贊
return { Property1 : 125, Property2 : "something", Method1 : function() { /* do nothing */ }, array: [5, 3, 6, 7]};
var o = { property1 : 125, property2 : "something", method1 : function() { /* do nothing */ }, array: [5, 3, 6, 7]};alert(o.property1); // Will display "125"
// The parenthesis '(' & ')' around the object are important herevar o = eval('(' + "{key: \"value\"}" + ')');
添加回答
舉報
0/150
提交
取消