Hello everyone,
If/else statements change the way a code is run. When you start JavaScrip you can run a sequence of code as instructions to do certain things, when you add an if/else statement into a code they run based on certain conditions. For example, true or false statements, if the response to a program is true it may execute one thing and if it is false it will execute something else. These conditional statements are very useful when trying to see if a statement is true or false and allows you to ask this question within one operation. Another Boolean expression I want to talk about is Not a Number (NaN). The purpose of NaN is to see if a value is a number or not, this is important when you are working with strings. A string in JavaScript is used to sort text within a quote, it is also used to connect pieces of information. An example of a string would be ‘Hello World’. A number example of a string is 1+2+ “3”= 33 because 3 is in quotes it will be viewed as a string making the answer 33 instead of 6.
Leave a Reply
You must be logged in to post a comment.