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

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -