I’m looking at some example code:
function iLoveCheese(){
return {
'c': thenumber, 'd': anothernumber
}
}
Say I want to use ‘thenumber’ in a program, can I just do:-
function lotsOfCheese(){
var t = iLoveCheese();
return t.thenumber;
}
Is a correct understanding?
Your
lotsOfCheesefunction is not going to work as excepted. This is because theILoveCheesefunction returns an object. You need to reference this object by it’s keys, not it’s values.This will return a value,
thenumber