Question: Create a new file called basic.js, containing the following line of code: console.log('External'); Save the file in the same folder as js.html Now, update js.html

Create a new file called basic.js, containing the following line of code: console.log('External'); Save the file in the same folder as js.html Now, update js.html to include the external file by including the following HTML code somewhere in the page (either in the head or in the body element): Reload the page and review the console output in the developer tools. What did you notice about the order of the console.log output? What happens if you include the basic.js external script multiple times?

Task 3 Control structures JavaScript has a number of control structures, including for loops, if statements, while loops, and switch statements. Most of these concepts should be familiar to you from your previous programming experience in particular we have covered some of these in PHP already in lab 1. Review the MDN JavaScript guide at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Control_flow_and_error_handling and attempt the following tasks, mirroring the exercise in Lab 1. You may refer to your lab 1 solution. Modify basic.js to perform the following: Use a for loop to print numbers 1 to 10 to the console Use a while loop to print numbers 1 to 10 to the console Use an if statement to print out 5 found inside the while loop if the value of the loop counter is 5. Make sure you test as you go dont write all three pieces at once, work in increments.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!