Page 1 of 1

Lab 3-2: Using functions, arguments and return values in JavaScript Objective 1.3.1: Methods as functions Objective 1.3.

Posted: Mon Jun 06, 2022 5:07 pm
by answerhappygod
Lab 3 2 Using Functions Arguments And Return Values In Javascript Objective 1 3 1 Methods As Functions Objective 1 3 1
Lab 3 2 Using Functions Arguments And Return Values In Javascript Objective 1 3 1 Methods As Functions Objective 1 3 1 (40.55 KiB) Viewed 38 times
Lab 3 2 Using Functions Arguments And Return Values In Javascript Objective 1 3 1 Methods As Functions Objective 1 3 2
Lab 3 2 Using Functions Arguments And Return Values In Javascript Objective 1 3 1 Methods As Functions Objective 1 3 2 (35.67 KiB) Viewed 38 times
Lab 3-2: Using functions, arguments and return values in JavaScript Objective 1.3.1: Methods as functions Objective 1.3.2: Using functions In this lab, you will create a simple function, pass arguments to that function when it is called, and return a value to the calling statement 1. Editor: Open lab3-2.htm from your student labs files. 2. Editor: Create two functions: one that takes an argument and one that returns a value Add an onclick event handler to both cinput> tags. Use this event handler to invoke the functions. 3. Editor: Save lab3-2.htm 4. Browser: Open lab3-2.htm. Your screen should resemble Figure 3-2 CIW JavaScript Specialist Call Function with arguments Call Function with return Desobe @Listen Figure 3-2: Output 5. Browser: Click Call Function with arguments You should see an alert as shown in Figure 3-3 This page says: The function has been called with an argument Welcome! Figure 3-3: Result of the function call 6 Browser: Click OK 7. Click Call Function with retum. You should see an alert as shown in Figure 3-4 This page says: Hi this value is returned from a function Prevent this page from creating additional dialogs Figure 3-4: Result of the function call 8. Browser: Click OK OK OK tion as an argument. The function

lab3-2.htm#X 1 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> 5 <title>Lab 3-2</title> 6 7 <script type="text/javascript"> 8 411 9 B/********* *********** Define a function that takes arguments on function call ******* ************/ /*********** ******* Define a function that takes returns a value *******/ //→→> 19 </script> 20 21 </head> 22 I 23 <body> <h3>CIW JavaScript Specialist</h3> <hr /> <!-- Add an onclick event handler to call the function - <form name="ayForm"> <input type="button" value="Call Function with arguments" /><br /> <input type="button" value="Call Function with return" /> </form> </body> </html> 2 3 4 SAHAAHHA====*** 10 11 12 13 14 15 16 17 18 24 25 26 27 28 29 30 31 32 33 34 35 36 37