Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IT Review JAVASCRIPT (Can someone please help me answer the below questions. It would be nice if you add comments explaining what you are doing?

IT Review JAVASCRIPT

(Can someone please help me answer the below questions. It would be nice if you add comments explaining what you are doing? If unable to add comments the answer would be fantastic. Thank you.

For each of the questions below, indicate what will print.

  1. var x = 3; var y = 2;

if (x / y >= 2)

{

document.write(x + y);

}

else

{

document.write(x * y);

}

  1. var x = 5; var y = 4;

if (y - x >= 0)

{

document.write(x + y);

}

else if (x % y == 0)

{

document.write(y - x);

}

else

{

document.write(x * y);

}

  1. var i = 0;

while (i <= 5)

{

document.write(i + ' ');

i++;

}

  1. function mystery(a, b)

{

var answer = b a / 2;

return answer;

}

var x = 4;

var y = 2;

document.write(mystery(x, y));

  1. function mystery(a)

{

for(var i = a; i > 0; i++)

{

document.write(i);

}

}

mystery(4);

  1. var word = Hello;

for (var i = 0; i <= 4; i++)

{

document.write(word.charAt[i]);

}

  1. var nums = [4, 2, 1, 3];

if (nums [2] == 2)

{

if (nums.length >= 3)

{

document.write("a");

}

else

{

document.write("b");

}

}

else

{

if (nums.length <= 3)

{

document.write("c");

}

}

  1. var color = blue;

var shape = circle;

var result = ;

if (shape == Circle)

{

if (shape.length > 4)

{

result += S;

}

else

{

result += H;

}

}

else if (color.endsWith(e))

{

if (color.length <= 4)

{

result += A;

}

if (shape.length != 5)

{

result += P;

}

}

else

{

result += E;

}

document.write(result);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions