juan field
asked on
how can i read the code replacing the two arguments (the object and the key ) and return true ?
function addProperty(obj, key){
if(obj[key]){
return true;
} return false;
}
var myObj = {};
addProperty(myObj, 'myProperty');
console.log(myObj.myProper ty); // --> true
////////////////////////// ////////// ////////// ////////// ////////// ////////// ////////// //////////
Given an object, and a key, "addProperty" sets a new property on the given object with a value of true.
var myObj = {};
addProperty(myObj, 'myProperty');
console.log(myObj.myProper ty); // --> true
Starter Code :
function addProperty(obj, key) {
// your code here
}
if(obj[key]){
return true;
} return false;
}
var myObj = {};
addProperty(myObj, 'myProperty');
console.log(myObj.myProper
//////////////////////////
Given an object, and a key, "addProperty" sets a new property on the given object with a value of true.
var myObj = {};
addProperty(myObj, 'myProperty');
console.log(myObj.myProper
Starter Code :
function addProperty(obj, key) {
// your code here
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER