facebook - Using object with functions in javascript -


hey guys new javascript development. have been confused objects used in javascript..i have took facebook javascript sdk , found out code.

fb.getlogin(function(response)) {     "data": [  {    "name": "xxx",     "id": "yyy"  },  {    "name": "zzz",     "id": "ooo"  },  

}

in fb-js-sdk obect properties can accessed console.log(response.data[0].name ).this seems natural.

but when tried actual code in js(not fb sdk)

function some() {  return 5 }   some.anotherfunction(function() {  {   "name" : "randomname"  "age" : 12  } 

when tried acess object anotherfunction.name shows error.i know doing wrong in code .it helpful if me in finding error , fixing ..any appreciated..

i think function doesn't return anything. try using return in object:

some.anotherfunction(function() {       return {        "name" : "randomname"        "age" : 12        }     ) 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -