javascript - Why is it returning undefined? -


i want store following method, , constant value, querying using key find value or value find key

function my_reference() {   return {     30:'',     31:'err591',     32:'err761',     33:'err671',     34:'err551',    }; }  console.log( my_reference[31],               my_reference.31,               my_reference().31,              my_reference()[31] ); 

my_reference[31],  

trying read property (which doesn't exist) of function. property on object return value of calling function.

my_reference.31,  

trying use number identifier. isn't allowed.

my_reference().31, 

trying use number identifier. isn't allowed.

my_reference()[31] 

this works


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -