In: Computer Science
/* Assignment : Complete this javascript file according to the individual instructions given in the comments. */ // 1) Utilize comments to prevent the following line from executing alert('Danger!'); // 2) Assign a value of 5 to a variable named x // and print the value of x to the console // 3) Assign a value of 10 to a variable named myNum // and print the value of myNum to the console // 4) Assign the product of x and myNum to a variable named myTotal // and print the value of myTotal to the console // 5) Assign your name to a variable named myName // and print the result of myName + myNum to the console // 6) Use the addition assignment operator to add 8 to the variable x // and print the new value of x to the console // 7) Assign the remainder of x divided by 5 to a variable named myRem // and print the value of myRem to the console // 8) Assign a value of 1 to a variable named i // print i++ directly to the console // 9) Now print ++i directly to the console // 10) Assign (myNum === myName) to a variable named myBoo // print the value of myBoo to the console
/* Assignment : Complete this javascript file according to the individual instructions given in the comments. */ // 1) Utilize comments to prevent the following line from executing alert('Danger!'); // 2) Assign a value of 5 to a variable named x var x = 5; // and print the value of x to the console console.log(x); // 3) Assign a value of 10 to a variable named myNum var myNum = 10; // and print the value of myNum to the console console.log(myNum); // 4) Assign the product of x and myNum to a variable named myTotal var myTotal = x * myNum; // and print the value of myTotal to the console console.log(myTotal); // 5) Assign your name to a variable named myName var myName = 'Your Name'; // and print the result of myName + myNum to the console console.log(myName + myNum); // 6) Use the addition assignment operator to add 8 to the variable x x += 8; // and print the new value of x to the console console.log(x); // 7) Assign the remainder of x divided by 5 to a variable named myRem var myRem = x % 5; // and print the value of myRem to the console console.log(myRem); // 8) Assign a value of 1 to a variable named i var i = 1; // print i++ directly to the console console.log(i++); // 9) Now print ++i directly to the console console.log(++i); // 10) Assign (myNum === myName) to a variable named myBoo var myBoo = (myNum === myName); // print the value of myBoo to the console console.log(myBoo);