-
Notifications
You must be signed in to change notification settings - Fork 0
Operators : JS
Marie-Louise edited this page Jan 17, 2019
·
4 revisions
now = 2018;
ageJohn = 28;
ageMark = 33;
console.log(ageJohn);
console.log(now + 2);
console.log(now * 2);
console.log(now / 10);
var johnOlder = ageJohn < ageMark;
console.log(johnOlder);
console.log(typeof johnOlder);
console.log(typeof ageJohn);
console.log(typeof 'Mark is older than John');
which means, which operator is executed first
var now = 2018;
var yearJohn = 1989;
in this line the - gets executed first, then >= and then = is last.
var isFullAge = now - yearJohn >= fullAge; //true
console.log(isFullAge);
in the line below the grouping (..) will take the highest precedent so will be executed first.
var average = (ageJohn + ageMark) / 2;