Question

In: Computer Science

/* Assignment : Complete this javascript file according to the individual instructions given in the comments....

/* 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

Solutions

Expert Solution

/* 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);

Related Solutions

/* Assignment: Complete this javascript file according to instructions given in the comments. */ // 1)...
/* Assignment: Complete this javascript file according to instructions given in the comments. */ // 1) Declare a variable named myName equal to your first name //Firstname is Susan // Construct a basic IF statement that prints the variable to the // console IF the length of myName is greater than 1 // 2) Copy your IF statement from above and paste it below // Change the IF statement to check if the length of myName // is greater than...
Please complete the following code in C using the comments as instructions. Further instructions are below...
Please complete the following code in C using the comments as instructions. Further instructions are below the code. challenge.c // goal: print the environment variables to the file "env.txt", one per line // (If envp is NULL, the file should be empty, opening in write mode will do that.) // example: // inputs: // envp/environ = {"E1=2","E2=7",NULL} // outputs: // env.txt as a string would be "E1=2\nE2=7\n" // example: // inputs: // envp/environ = {NULL} or NULL // outputs: //...
I need to complete this C++ program. The instructions are in the comments inside the code...
I need to complete this C++ program. The instructions are in the comments inside the code below: ------------------------------------------------------------------------- Original string is: this is a secret! Encypted string is: uijt!jt!b!tfdsfu" Decrypted string is: this is a secret! //Encoding program //Pre-_____? //other necessary stuff here int main() { //create a string to encrypt using a char array cout<< "Original string is: "<<string<<endl; encrypt(string); cout<< "Encrypted string is: "<<string<<endl; decrypt(string); cout<<"Decrypted string is: "<<string<<endl; return 0; } void encrypt(char e[]) { //Write implementation...
Task 8.2 - Individual report. * Instructions: According to the instructions in module one, present an...
Task 8.2 - Individual report. * Instructions: According to the instructions in module one, present an individual report on the assigned topic (choose one of the 10 presented). The report will include aspects such as: definition of the topic, Historical background, advantages and disadvantages and your arguments on the contribution that you consider most significant and impactful for business administration. Present examples of corporations currently applying this method successfully. The report must be written using the essay type writing format...
Download this file to your hard drive and follow the instructions in the Module 9 Assignment...
Download this file to your hard drive and follow the instructions in the Module 9 Assignment (Word) document. Prepare two files for your post. The first file should be a text file containing your Python solution. The second file should contain your output file(txt). Complete the following using Python on a single text file and submit your code and your output as separate documents. For each problem create the necessary list objects and write code to perform the following examples:...
Instructions: Complete the following case study and upload it to the assignment section prior to the...
Instructions: Complete the following case study and upload it to the assignment section prior to the due date. This will contribute towards the case study portion of a student’s grade. Case study answers must be typed. Point values are assigned per question. Patient Profile M.W. is a 65-year-old female. She is a retired auto worker who lives in a condo with her golden retriever, Charlie. She has a history of diabetes type II diagnosed 3 years ago. She had a...
Respond to the following prompt to complete the CTE assignment. Be sure to follow the instructions...
Respond to the following prompt to complete the CTE assignment. Be sure to follow the instructions in the syllabus and your grade will be determined through the use of the related rubric (also located in the syllabus). As the Baby Boom generation continues to retire from the labor force, the ratio of retirees to workers will continue to increase. How will this demographic change impact the Social Security program? What "solution" or "solutions" would best offset the harmful effects of...
Instructions: Complete the following case study and upload it to the assignment section prior to the...
Instructions: Complete the following case study and upload it to the assignment section prior to the due date. This will contribute towards the case study portion of a student’s grade. Case study answers must be typed. Point values are assigned per question. Patient Profile M.W. is a 65-year-old female. She is a retired auto worker who lives in a condo with her golden retriever, Charlie. She has a history of diabetes type II diagnosed 3 years ago. She had a...
(Javascript) Modify the JavaScript file to implement a function named calculateTotalPrice. At the bottom of the...
(Javascript) Modify the JavaScript file to implement a function named calculateTotalPrice. At the bottom of the file are sample inputs and outputs to test your implementation. /* * The price per ticket depends on the number of tickets * purchased, there are 4 ticket pricing tiers. Given the * number of tickets return the total price, formatted to * exactly two decimal places with a leading dollar sign. * Tier 1: *   Minimum number of tickets: 1 *   Price per...
This needs to be written in JavaScript with two files. One HTML file and a JavaScript...
This needs to be written in JavaScript with two files. One HTML file and a JavaScript file. Make an empty HTML file, put three buttons inside the body and an empty main tag below the buttons. The text of the buttons should be "Foo", "Bar", and "FooBar" respectively. Don't put the " in the buttons that's just for clarification in these instructions. Add unique IDs to each button In your JavaScript, get 3 separate references to the buttons using the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT