Some basics regarding javascript and how they work.
This is known as a string, a string is often seen as such let string(“This is a string”)
Operators are simply things used to denote actions happening to variables that have been assigned previously, as well as assigning variables themselves. For example, +, -, =, and += are all operators when it comes to actions taken against variables. The most common one used when it comes to JavaScript is the assignment operator also known as the equals(=). This operator will assign a value whether it be a string, or a number to a variable you as the user choose. Like x = 3 the operator will assign the value of three to x. As well as 3-2 the minus/subtract operator will take 2 from 3.
A real world problem I personally could solve using a function would be taking recognizing user acknowledgement or input for a form and giving a check mark next to a task that needs to be done.
An if statement checks a (function condition) and if it evaluates to (true) then the code block will execute.
What is the use of an else if?
| The need for an else if statement is typically reserved for a conditional function that needs three or more conditions before executing a specific block of code. For example if(x = y) run this block else if(x = z) run this block else(x ! y | z) run this block of code instead. |
There is the typical == operator which is a loose equal to operator, such as 3 == “three” they are similar enough that it’d return true. Then there’s === which is considered the absolute equal operator, using the previous example if we used 3 === “three” it’d return false, while the information may be the same, the value and type of these two don’t match one is a number and the other a string so the webpage would return a false result. Then we got the infamous != which indicates does not equal it’s often used as a check for information. Such as if we dedicate the value 5 to the variable X and we say in a function if(x!= 7) run block of code. In this instance the script will check to see if X has a value of 7, if it doesn’t it runs the code. If it does equal 7 it won’t run.
| What is the difference between the lgocial operator && and the |
| The difference between these two operators is probably a lot easier than most realize. The first one is the and operator, it’s often used for conditional arguments such as x = 12 && 10 though not in that format. It takes into account two conditions and if they both return true then the block of code will run and it’s counterpart the | operator otherwise known as or, is a more loose consideration of factors. If one this is like condition one OR is like condition two, run the block of code. They typically come in handy with conditional functions. |