Use Conditional Logic with If Statements
This commit is contained in:
		
				
					committed by
					
						
						SaintPeter
					
				
			
			
				
	
			
			
			
						parent
						
							ac57d717f5
						
					
				
				
					commit
					b48e7b7874
				
			@@ -2223,12 +2223,12 @@
 | 
				
			|||||||
      "title": "Use Conditional Logic with If Statements",
 | 
					      "title": "Use Conditional Logic with If Statements",
 | 
				
			||||||
      "description": [
 | 
					      "description": [
 | 
				
			||||||
        "We can use <code>if</code> statements in JavaScript to only execute code if a certain condition is met.",
 | 
					        "We can use <code>if</code> statements in JavaScript to only execute code if a certain condition is met.",
 | 
				
			||||||
        "<code>if</code> statements require a boolean condition to evaluate.  If the boolean evaluates to true, the statement inside the curly braces executes.  If it evaluates to false, the code will not execute.",
 | 
					        "<code>if</code> statements require a <dfn>boolean</dfn> condition to evaluate.  If the boolean evaluates to <code>true</code>, the statement inside the curly braces executes. If it evaluates to <code>false</code>, the code will not execute.",
 | 
				
			||||||
        "For example:",
 | 
					        "For example:",
 | 
				
			||||||
        "<blockquote>function test(myVal) {<br />  if (myVal > 10) {<br />     return \"Greater Than\";<br />  }<br />  return \"Not Greater Than\";<br />}</blockquote>",
 | 
					        "<blockquote>function test(myVal) {<br>  if (myVal > 10) {<br>     return \"Greater Than\";<br>  }<br>  return \"Not Greater Than\";<br>}</blockquote>",
 | 
				
			||||||
        "If <code>myVal</code> is greater than <code>10</code>, the function will return \"Greater Than\".  If it is not, the function will return \"Not Greater Than\".",
 | 
					        "If <code>myVal</code> is greater than <code>10</code>, the function will return <code>\"Greater Than\"</code>.  If it is not, the function will return <code>\"Not Greater Than\"</code>.",
 | 
				
			||||||
        "<h4>Instructions</h4>",
 | 
					        "<h4>Instructions</h4>",
 | 
				
			||||||
        "Create an <code>if</code> statement inside the function to return <code>\"Yes\"</code> if <code>testMe</code> is greater than <code>5</code>.  Return <code>\"No\"</code> if it is less than <code>5</code>."
 | 
					        "Create an <code>if</code> statement inside the function to return <code>\"Yes\"</code> if <code>testMe</code> is greater than <code>5</code>.  Return <code>\"No\"</code> if it is less than or equal to <code>5</code>."
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      "tests": [
 | 
					      "tests": [
 | 
				
			||||||
        "assert(typeof myFunction === \"function\", 'message: <code>myFunction</code> should be a function');",
 | 
					        "assert(typeof myFunction === \"function\", 'message: <code>myFunction</code> should be a function');",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user