Unique object literal keys- javascript -
var obj = {"":"empty string", "!":"bang", "hello world":"hello world"}
-fix these lines of code works?
whatever method i've tried, keep coming undefined property name "" or error when calling !.
i'm new coding , not looking answer, maybe push in right direction..so please gentle ,
you must call obj array
console.log( obj [''] ); // "empty string" console.log( obj ['!'] ); // "bang" var x='!'; console.log( obj [x] ); // "bang"
Comments
Post a Comment