Given the following JavaScript code, what will be displayed on the web page?
var pho = new Array();
for (var i = 0; i< 7; i++)
{
pho[i] = (i*i) + 3;
}
for (var i = 0; i< 7; i++)
{
document.write(i + " => " + pho[i] + "<br>");
}
1 => 4
2 => 7
3 => 12
4 => 19
5 => 28
6 => 39
Given the following JavaScript code, what will be displayed on the web page? var pho =...
Given the following JavaScript code, what will be displayed on the web page? var x = 5; var y = 12; while (x < y) { document.write(x); document.write("<br>"); x=x+3; }
Given the following JavaScript code, what will be displayed on the web page? var k=1; var m=0; var p=0; while (k<=4) { k++; for (p=1; p<=4; p++) { document.write(p +" "); } document.write("<br>"); }
Given the following JavaScript code, what will be displayed on the web page? var i, j; for (i=1; i<=3; i++) { for (j=2; j<=5; j++) { document.write(i+ "," + j + "; "); } document.write("<br>"); } 2,3; 3,4; 4,5; 4,6;
What is the problem with this code? <html> <body> <script type="text/javascript"> //Declare variables var numStudents; var index; var sName; var ES = ""; var BR = "<br />"; var PA = "<p />"; //Print statement document.write("Student Name Entry Program" + PA); //Prompt for number of students to add numStudents = prompt("Enter the number of student names to add: "+ ES); //Loop through numStudents of times, prompting for student names for(index = 1; index <= numStudents: index++) { sName = prompt("Enter...
1. Given the following code snippet, what is the scope of the variable pen on Line 1? <script> 1. var pen = "ball point"; 2. var pencil = "0.7mm lead"; 3. function writeIt() 4. { 5. document.write(I have a " + pen + " pen."); 6. pen = "gel ink"; 7. document.write("You have a " + pen + " pen."); 8. var pencil = "0.5mm lead"; 9. document.write("I prefer pencils with " + pencil + "."); 10. } <script> A. global B....
JavaScript 30. What will be displayed after the following code is entered and run if the user enters "9 am" at the first prompt and "N-215" at the second prompt? If you think there is an error, describe how you would fix it. function examTime() { var time = prompt("What time is the exam?"); var room = prompt("What room is the exam in?"); showIt(time, room); } function showIt(a, b) { document.write("Your exam is in room " + a + "...
Consider the following JavaScript skeletal program: //the main program var x: function sub1 () { var x: function sub2 () { } } function sub3 () { } Assume the execution of this program is in the following unit order: main calls sub1 sub1 calls sub2 sub2 calls sub3 a. Assuming static scoping, which declaration of x is the correct one for a reference to x in: i. sub1 ii. sub2 iii. sub3 b. Repeat part a, but assume dynamic...
Exercise 30 refer to the following code: var vacation = prompt("What do you want to do during Spring Break? ↵ Type S for skiing, F for fishing, H for hiking,8 J for learning JavaScript.", " "); if (vacation == 'S') document.write("You should go to Aspen.<br />"); if (vacation == 'H') document.write("Be sure to buy good hiking boots.<br />"); if (vacation == 'F') document.write("Worms make good bait.<br />"); if (vacation == 'J') document.write("You're gonna have soooo much fun!<br />"); 30. Rewrite...
Directions: Read the scenario for each problem as well as the JavaScript code. Circle the programming error (logical or syntax) . threr is 8 errors . please hightlight errors. Create two functions for the following scenario. Function 1: Write a two-argument function to calculate a person’s holiday bonus based on the total number of hours worked during the past four weeks and whether the employee is full-time (FT) or part-time (PT). Function 2: Write a second function to see if...
Question: How can this code be rewritten without using
array?
Code in action here:
After Inserting number:
Full code is here:
How would I rewrite this without using built in array or an
array?
C nked list ← ⓘ솔JSFiddle Ltd (GB) https:/JSfiddle.net/7m80w1c5/2/ .Most Visited @ Getting StartedのHP-See what's Hot Suggested Sites . Comments for The Ch web Slice Gallery C New Tab 60 D> Run 9 Update Fork Tidy Collaborate Embed v/ Settings <form> iddle Meta HTML Insert Number Here:<br>...