Evaluate some complex expressions of JavaScript
The answer pattern should be step by step
check the PDF attachment
The questions as follows
- true || false && true
- let firstName = “trouble”; let lastName = “double”; (firstName === “Batman” || firstName === “Trouble”) && (lastName === “Batman” || lastName === “kong” )
- let a = 21;
a += 3;
let b = 5;
b -= a;
(a < 1) || (b >= 1) && (a != b)
- let pet = “alligator”; let escape = “boat”; “The “ + pet + “ escaped. It was last seen on a “ + escape;
- let George = “orge”; let nickname = “Conquerer”; let combinedName = George + “ “ + nickname;
- ((42 === “42”) && (42== “42”)) || ((42 < “Whistle”) || (42 > “234”))
- ((24*23+12/2+22) % 2 === 1)
- ((Math.pow(3,3) === 27) || (Math.cos(Math.PI) === 0)) || (Math.pow(Math.sin(1.2),1)+Math.pow(Math.cos(1.2),2) === 1)
- let sentence = “The world is green!”;
- let bigCar = true;
(combinedName === George) || (George !== “George”) &&(combinedName === “Conquerer”) || (nickname === 42)
sentence.substring(4,9) === “world” && sentence.length < 20 && sentence.length > 5 && sentence.substring(0,3) === “The world is red”.substring(0,3);
let bearTrap; “The variable bigCar has the value : “+ bigCar + “, while variable bearTrap is ” + bearTrap + “If I compare bearTrap with undefined I get ” + bearTrap===undefined
Sample Solution