Font size
WorksheetsCuestionario de Certificación JS 2024
Total questions: 17
Worksheet time: 17mins
Variable x has a value of 5, variable y has a value of 8.
Select True if the expression evaluates to true, or False if it does not.
x < 4 || y > 8
True
False
Your instructor has the following exception handling requirements.
The displayInfo() function must use exception handling.
The display() function must always run, regardless of whether an exception occurs.
If there is an exception, the script must call the logDisplayInError() and correctDisplayInfo() functions.
What is the correct opction for complete the code?
catch
catch(msg)
You are writing JavaScript code that manipulate dates.
You need to initialize a Date object with the date January 1, 2021 by using the year, month, and date parameters.
Complete the code by selecting the correct option.
var date = new Date( 2021 , _______ , ________)
0
1
01
What is the correct syntax to determine if a string called str is empty?
str == null
str == "null"
str == ""
str == "empty"
You are creating a JavaScript program for an accounting system.
You evaluate the code to ensure that it follows JavaScript best practices.
Which two lines of code contain reserved words? (Choose 2)
01
02
03
04
05
You are helping a coworker test the following form.
The form will submit to a script named contact.
True
False
Complete the code by selecting the correct option from each dropdown list.
The page allows users to create a problem ticket and send an email to help@societyrugby.com. The email contains a problem description, the user’s name and user’s phone number.
You need to perform custom validation of the user’s phone number (yourPhoneNumber) when the page attempts to send the problem ticket (problemTicket).
Which property, method, or event of the form object should you use?
target
onclick
onsubmit
setCustomValidity
You are using JavaScript to develop a Tic - Tac – Toe program, You write the following code.
Which array element contains the “0”? ____________
grid[1][3]
grid[2][1]
grid[0][2]
grid[3][1]
A web page displays the following image element.
<img src=”images/cottage.jpg” id=”cottage” alt=”Vacation Cottage” style=”width:150px; height=100px”>;
When the user hovers over the image element, the page should call a displayText function. You are writting the code to call the function.
document.getElementById(“cottage”).onmouseover = displayText();
document.getElementById(“cottage”).addEventListener(“mouseover”, displayText());
document.getElementById(“cottage”). addEventListener(“mouseover”, displayText);
document.getElementById(“cottage”). addEventListener(“onmouseover”, displayText());
You write the following code. Line numbers are included for reference only.
You need to ensure that the function returns true only if the amount is equal to or less than the currentBalance.
if (amount >= currentBalance) {
if (amount < currentBalance) {
if (amount <= currentBalance) {
if (amount > currentBalance) {
You run the following code displayed in the image.
What value is stored in the variable chain after the code runs?
3 4 5 6 7
0 1
0 1 3 4 5 6 7 8
1 3 4 5 6 7 8
0 1 3 4 5 6 7
Which JavaScript code fragment will store only the number 42 in the variable iNum as a number?
var iNum = “42fred”;
var iNum = ”42fred”;
iNum = iNum.substr(1,2);
var iNum = “42fred”;
iNum = iNum.substr(2,2);
var iNum = parseInt(“42fred”);
The window.document.getElementById(elementName)
method returns the element that has the name attribute with the
value specified in the elementName parameters.
True
False
Several HTML documents need to reference the same JavaScript code. Where should the JavaScript code reside?
In a .css file
Inside the head tags of each document
In a .js file
Inside the body tags of each document
What will be the output of the following code snippet?
console.log(typeof null);
object
null
undefined
number
Which of the following methods can be used to convert a string to a number in JavaScript?
Number()
parseFloat()
parseInt()
All of the above
In JavaScript, which operator is used to compare both value and type?
==
===
!=
!==
