2017-08-11 93 views
-2

我是新手。請告訴下面的JavaScript有哪些不能顯示的功能,非常感謝。JavaScript無法顯示

var car = { 
    size: "small", 
    color: "red", 
    show: function() { 
    console.log("This is my " + car.size); 
    } 
}; 

show(); 
+0

使用'car.show()' – vatavale

回答

0

你必須使用car.show() 嘗試,然後回覆我cmnts什麼是你的輸出

var car = { size: "small", color: "red", show: function() { console.log("This is my " + car.size); } }; car.show(); // reffer to object first and then to your func

0
var car = { 
    size: "small", 
    color: "red", 
    show: function() { 
    console.log("This is my " + car.size); 
    } 
    }; 

car.show();// You should call like this