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 + " at " + b);
}
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
JavaScript 30. What will be displayed after the following code is entered and run if the...
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;
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
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...
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...
This is my code so far: <!DOCTYPE html> <html> <head> <title>JavaScript is fun</title> <meta charset="utf-8" /> </head> <body> <script type ="text/javascript"> //declare a variable and store text in it var x = "JavaScript is fun"; //write the variable 5 times document.write(x + x + x + x + x); //store 5 as string in variable x x = "5"; //store 3 as string in variable y var y = "3"; //write the value x + y to the document document.write("<br>");...
Please help me with this code for javascript. <!DOCTYPE html> <html> <head> <title>Strings and Arrays</title> <script> function wrangleArray() { var string1 = prompt("Enter: This class is going to fast");//Must be entered by the user var string1 = "";//Is this right? I want that string to change later by a series of prompt questions document.getElementById("div1").innerHTML = "<p>" + sentence + "</p>"; var words = sentence.split(" ");//I need to convert my string to an Array is this the way to do it?...