If I were to make this object:
var usr = {
function() {
usr.name = prompt('What\'s your name?');
// line 4
usr.age = prompt('How old are you?');
// line 6
usr.clr = prompt('What\'s your favorite color?');
// line 8
usr.pref = prompt('Which strain of marijuana is your favorite?');
// line 10
}
, could I make this function:
function timedLog(p, d) {
window.setTimeout(function(){
console.log('Noted. You\'ve chosen: ' + usr.p + '.');
}, d || 600)
};
?
My main concern is in calling the property: usr.p
. I'm assuming the p will be replaced, so I changed my first input (usr.+p+'etc...'
) to the aforementioned. Am I correct in assuming this, if I were to call the function as so:
timedLog(clr, 500);
? Is this an instance where the this
keyword word come into play: this.p
?