相关疑难解决方法(0)

Javascript对象文字:究竟是什么{a,b,c}?

我的问题最好通过这个jsfiddle,其代码如下:

var a = 1, b = 'x', c = true;

var d = {a: a, b: b, c: c}; // <--- object literal
var e = [a, b, c];          // <--- array
var f = {a, b, c};          // <--- what exactly is this??

// these all give the same output:
alert(d.a  + ', ' + d.b +  ', ' + d.c );
alert(e[0] + ', ' + e[1] + ', ' + e[2]);
alert(f.a  + ', …
Run Code Online (Sandbox Code Playgroud)

javascript ecmascript-6

82
推荐指数
3
解决办法
4499
查看次数

标签 统计

ecmascript-6 ×1

javascript ×1