DEV Community

Cover image for JS objects' example (coffee intensity)
Designer Anna
Designer Anna

Posted on • Originally published at twitter.com

JS objects' example (coffee intensity)

function intensity(a){
return a+"%";}
//JS objects
var coffee = {
intensity1:intensity(55),
intensity2:intensity(75),
intensity3:intensity(90)

};

document.write="Coffee is "+coffee.intensity1+" strong"
document.write="Coffee is "+coffee.intensity2+" strong"
document.write="Coffee is "+coffee.intensity3+" strong"

Discussion (0)