Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!