var price1 = 10; var price2 = 10; var price3 = new Number('10'); var price4 = price3; var price5 = new Number('10'); console.log(price1 === price2); // logs true: primitive values compared by value console.log(price1 === price3); //logs false: compares object with primitive console.log(price4 === price3);// logs true: same references alert("now checking price5...") console.log(price5 === price3);// logs false: diff references
No comments:
Post a Comment