Question
Lab 1: Complete and/or modify the code below as per the instructions included in each individual question. Your code should run in NODE.js as shown
Lab 1: Complete and/or modify the code below as per the instructions included in each individual question. Your code should run in NODE.js as shown in class. Some questions may need to be modified in order to run correctly, or written from scratch. You may decide. Note, you can create your answer beneath the question comment itself Q1: Output a welcome message to the console. The message should be contained inside of a string variable that is accessible by the entire program via it's scope. Q2: Create a conditional statement that outputs the grade of a student based on their mark. You may use an IF or a SWITCH. I'll get you started. var grade; var mark = 94; // ... console.log("The student received an " + grade + " in the course!"); Q3: This the following 4 lines of code has a bug and doesn't add correctly. Find the bug and fix it so the output is correct. Add comments to show that you've corrected the bug appropriately. var y = "4"; var x = 20; var total = x + y; console.log(x + " + " + y + " = " + total);
Q4: Create a function that multiply's two numbers together and outputs the answer. The function must accept 2 parameters. Don't forget about SCOPE if you're using varibles inside of your function. Q5: Using your multiply function, use the shortest amount of code to display the following output on the screen: 1 * 1 = 1 2 * 2 = 4 3 * 3 = 9 4 * 4 = 16 5 * 5 = 25 6 * 6 = 36 7 * 7 = 49 8 * 8 = 64 9 * 9 = 81 10 * 10 = 100 Q6: Determine using a conditional statement, if the following variable is a number or is not not a number. If it is not, try to convert it to a number and use your mult() function to multiply it by 2. NOTE: YOU MAY NOT MODIFY ANY VARIBLES that are Constants. const number = "17";
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started