- script.js
JavaScript
var buildComputer = function (memory, display, processor) {
var computer = {
basicPrice: 5000,
processor: processor,
display: display,
memory: memory
};
return computer;
};
var myComputer = buildComputer(8, 13, 'i7');
console.log(myComputer);
Result
Goalscompleted
- Add the
getDescriptionmethod, which returns the'computer'line, to thecomputerobject. - Instead of logging variable
myComputerin the console, log message'In the cart ' + myComputer.getDescription().
Comments