-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathpractice.js
More file actions
48 lines (36 loc) · 1.62 KB
/
Copy pathpractice.js
File metadata and controls
48 lines (36 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**** ORDER OF CODE EXECUTION: PRACTICE ****/
/** STRINGBUILDING **/
// 1. TODO: Re-order the lines of code below so that running the file produces these two
// lines of output:
// JAVA
// JAVASCRIPT
word = word + "PT";
word = word + "VA";
word = word + "RI";
word = word + "SC";
word = word + "JA";
let word = "";
console.log(word);
console.log(word);
// Run the file before moving on to ensure you get the expected result.
/** DATA MANIPULATION **/
// 2. TODO: Plan out the additional lines of code needed according to the following guidelines:
// A) You will modify some existing numbers. The final sum in the console should be 445.
// B) The sum should be calculated by adding all modified numbers and storing
// it in a new variable. Print only that new variable.
// C) Use the + and - operators to add and subtract numbers as required
// D) All odd numbers should be made even by adding 1 to their value and
// reassigning them to the same variable name without changing the original assignment.
// E) All even numbers should be made odd by subtracting 5 from their value
// and reassigning to the same variable without changing the original assignment.
// Add code where needed below, then test by running the file.
// IMPORTANT: Do not edit the 6 existing lines of code; add NEW lines of code only.
let num1 = 56;
let num2 = 121;
let num3 = 73;
let num4 = 24;
let num5 = 88;
let num6 = 95;
// All done? Great job! Understanding how JavaScript executes and evaluates code is
// important. Keep these principles in mind as you solve future problems!
// TODO: Before you go... don't forget to make a git commit!