logo

Crowdly

Browser

Add to Chrome

WEB202_Web Development 2_24/25_T2_11.CCP

Looking for WEB202_Web Development 2_24/25_T2_11.CCP test answers and solutions? Browse our comprehensive collection of verified answers for WEB202_Web Development 2_24/25_T2_11.CCP at moodle.ncst.edu.bh.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

Context:

Accessing characters in a string using charAt.

What does this output?

const str = "JavaScript";

console.log(str.charAt(4));

]]>
0%
0%
0%
0%
View this question
What does this code snippet do? 

function getComputerChoice() {

 const choices = ["rock", "paper", "scissors"];

 const randomIndex = Math.floor(Math.random() * choices.length);

 return choices[randomIndex];

0%
0%
0%
0%
View this question
What does the following test check? 

test('adds 2 + 2 to equal 4', () => {

 expect(add(2, 2)).toBe(4);

}); 

View this question
Context:

Dynamic modification of multiple elements.

What is the output of:

document.querySelectorAll('button').forEach(btn => btn.style.color = 'red');

]]>
0%
0%
0%
0%
View this question

Context:

Creating a new branch using Git CLI.

0%
0%
0%
0%
View this question

Context:

const arr = [1, 2, 3];

const total = arr.reduce((sum, num) => sum + num, 0);

console.log(total);

What is the output?

View this question
Question Reference:

We Have a New Problem: FooBarWrite a program that takes a user’s input and prints numbers from 1 to the inputted number. However:  - For multiples of 4, print "Foo" instead of the number.  - For multiples of 6, print "Bar" instead of the number.  - For numbers that are multiples of both 4 and 6 (i.e., 12, 24, etc.), print "FooBar".  

What kind of loop is best suited for iterating through numbers from 1 to a user-inputted value in JavaScript?

View this question
Context:

What happens when an object is reassigned?

Given:

let x = {value: 1};

let y = x;

x = {value: 2};

What is y.value?

]]>
0%
0%
0%
0%
View this question
Context:

Using .reduce on an array.

Given:

const arr = [1,2,3,4];

const sum = arr.reduce((a,b) => a+b, 0);

What is the value of sum?

]]>
0%
0%
0%
0%
View this question

What is the correct way to write a function that multiplies two numbers?

View this question

Want instant access to all verified answers on moodle.ncst.edu.bh?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome