Hi All,
I’m on lesson 81 of the Basic JavaScript course and I have come to a point where the example code has me lost. I’m taking special care to really grasp the concepts before moving forward, so maybe someone can help me understand what is happening in this bit of code. I’m particularly lost by the propPrefix function, how it works or what purpose it serves.
var someObj = {
propName: "John"
};
function propPrefix(str) {
var s = "prop";
return s + str;
}
var someProp = propPrefix("Name"); // someProp now holds the value 'propName'
console.log(someObj[someProp]); // "John"