-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathif_string_function_array_practice
More file actions
21 lines (11 loc) · 1.58 KB
/
if_string_function_array_practice
File metadata and controls
21 lines (11 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// 1. Use a variable to store a number, then write a condition that prints 1 if the number is over 9000, and prints -1 otherwise.
// 2. Use a variable to store a number, then write a condition that prints 100 if the number equals 100, prints 99 if the number is equal to 99, and prints 0 otherwise.
// 3. Use variables to store two numbers, then write a condition that prints 1 if the first number is less than zero and the second number is greater than 0, and prints 0 otherwise.
// 4. Write a program that uses variables to store the names of three cities, then prints out a sentence using that information with string concatenation (the + operator).
// 5. Write a program that uses variables to store a movies title and lead actor, then prints out a sentence using that information using string concatenation (the + operator).
// 6. Write a function that takes in a string and returns the string with all capital letters. Then run the function and print the result.
// 7. Write a function that takes in a string and returns the first letter of the string. Then run the function and print the result.
// 8. Write a function that takes in 3 numbers and returns the average (the sum divided by 3.0). Then run the function and print the result.
// 9. Create an array to store 3 words. Then add two more words to the array and print the array on one line.
// 10. Create an array to store 4 letters. Then change the second letter to a number and print the array on one line.
SOLUTIONS: https://github.com/TaylorOD/Deliberate_Practice-JavaScript/blob/master/solution_key/if_string_function_array_solutions.js