JavaScript Question 17 (1 point) In the code that follows, window is a/an window
ID: 3910254 • Letter: J
Question
JavaScript
Question 17 (1 point)
In the code that follows, window is a/an
window.prompt("Enter your name");
object
method
keyword
Parameter
Question 18 (1 point)
In a web browser, the object that’s always available to JavaScript so you don’t have to code its name when you call one of its methods is
the window object
the document object
the HTML object
the browser object
Question 19 (1 point)
To display string or numeric data in a dialog box, use the
JavaScript print() method
JavaScript write() method
JavaScript prompt() method
JavaScript alert() method
Question 20 (1 point)
To allow a user to enter a value into a dialog box, use the
JavaScript print() method
JavaScript write() method
JavaScript prompt() method
JavaScript alert() method
Save
Question 21 (1 point)
Data or attributes that are associated with an object are its
methods
location
properties
operators
Save
Question 22 (1 point)
Assume userName equals “Tom” and userAge equals 22. What is displayed in a dialog box when the following statement is executed?
alert(userAge + " is " + userName + "'s age.");
22 is Tom's age.
22
is Tom's age.
22 is Tom's age.
22
is Tom's age.
uestion 23 (1 point)
Code Example 2-1
1. var myAge, newAge;
2. myAge = prompt("How old are you?");
3. myAge = parseInt(myAge);
4. newAge = 18 - myAge;
5. alert("You will be eligible to vote in " + newAge + " years");
(Refer to Code Example 2-1) What type of data is stored in myAge after line 2 is executed?
string data
integer data
numeric data
it is undefined
Question 24 (1 point)
Code Example 2-1
1. var myAge, newAge;
2. myAge = prompt("How old are you?");
3. myAge = parseInt(myAge);
4. newAge = 18 - myAge;
5. alert("You will be eligible to vote in " + newAge + " years");
(Refer to Code Example 2-1) What would be returned if the user entered “fifteen” at the prompt?
You will be eligible to vote in undefined years
You will be eligible to vote in NaN years
You will be eligible to vote in years
nothing, the program would not run
Question 25 (1 point)
Code Example 2-1
1. var myAge, newAge;
2. myAge = prompt("How old are you?");
3. myAge = parseInt(myAge);
4. newAge = 18 - myAge;
5. alert("You will be eligible to vote in " + newAge + " years");
(Refer to Code Example 2-1) What would be returned if the user entered 14.78 at the prompt?
You will be eligible to vote in 3 years
You will be eligible to vote in 4 years
You will be eligible to vote in 3.22 years
nothing, 14.78 is not an integer
Question 26 (1 point)
To write a string to a document, use
the write() or writeln() method
the prompt() method
the alert() method
all of these can be used
Save
Question 27 (1 point)
Which code would result in the same output as the following?
document.write("Welcome, my friend!<br>Glad you are here.");
document.writeln("<pre>Welcome, my friend!");
document.writeln("Glad you are here.</pre>");
document.writeln("<pre>Welcome, my friend! Glad you are here.</pre>");
document.writeln("Welcome, my friend!");
document.writeln("Glad you are here.");
document.writeln("<pre>Welcome, my friend!<br>Glad you are here.</pre>");
object
method
keyword
Parameter
Question 18 (1 point)
In a web browser, the object that’s always available to JavaScript so you don’t have to code its name when you call one of its methods is
the window object
the document object
the HTML object
the browser object
Question 19 (1 point)
To display string or numeric data in a dialog box, use the
JavaScript print() method
JavaScript write() method
JavaScript prompt() method
JavaScript alert() method
Question 20 (1 point)
To allow a user to enter a value into a dialog box, use the
JavaScript print() method
JavaScript write() method
JavaScript prompt() method
JavaScript alert() method
Save
Explanation / Answer
According to chegg guidelines i have to solve first four questions only but i solve five.
17.
18.
19.
Option c
20.
Option b
21.
Option a
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.