Do you think the value of isRed will change from false, which is the original value to true. By assignment of the if clause? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Do you think the value of isRed will change from false, which is the original value to true. By assignment of the if clause?

12:23 What will be the output of this program? enum colors { RED = "#FF0000", GREEN="#00FF00", BLUE = "0000FF", } let userChoice = "#FF0000"; let isRed: boolean = false; if (userChoice == colors.RED) { isRed = true; } console.log(isRed); Quick question here; don't you think that that value of isRed just changed from ๐—ณ๐—ฎ๐—น๐˜€๐—ฒ to ๐˜๐—ฟ๐˜‚๐—ฒ after the if clause posted an if question which is already true ... ๐—ฐ๐—ผ๐—น๐—ผ๐—ฟ๐˜€.๐—ฅ๐—˜๐—— =#๐—™๐—™0000 which is also equal to userChoice. the fact that for TypeScript , once u have typed a variable, u can change its valu. i think ๐Ÿšฉif ๐Ÿšฉ changes the value of the boolean statement๐Ÿค”

17th Mar 2022, 9:30 PM
Mike Fedha
Mike Fedha - avatar
1 Answer
17th Mar 2022, 11:16 PM
Solo
Solo - avatar