-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoding-practice.js
More file actions
55 lines (50 loc) · 1.4 KB
/
coding-practice.js
File metadata and controls
55 lines (50 loc) · 1.4 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
49
50
51
52
53
54
55
// Loops notes and examples
//
// while (condition){
// (body
// do {
// (body of code)
// console.log();
//the iteration will go below the body of code
// } while(condition); if you have to do something 'once' a do while will always run.
// for (intializationl; condition; increment) {
//
// }
// for(let i = 10; i > 0; i-=1) {
// console.log(`For Loop #${i}`);
// }
//
// loop through an array, and print the string in each item in a sentence;
// let array = ['oranges', 'apples', 'pineapples','pears', 'grapes', 'tomatoes'];
// for(let i = 0; i < array.length; i++){
// // console.log(`${array[i]} are awesome!`);
// }
//
// for (let i = 0; i < array.length; i++) {
// if (array[i] === 'tomatoes'){
// console.log(`Wait..${array[1]} are a fruit?!`);
// } else {
// fruitMessage(array[i]);
// }
// }
//
// function fruitMessage(input){
// console.log(`${input} are pretty cool!`);
// }
// let array = ['oranges', 'apples', 'pineapples','pears', 'grapes', 'tomatoes'];
// for(let i = 0; i < array.length; i++){
// // // console.log(`${array[i]} are awesome!`);
// }
//
// for (let i = 0; i < array.length; i++) {
// if (array[i] === 'tomatoes'){
// console.log(`I found you mr.tomatoes`);
// break;
// } else {
// fruitMessage(array[i]);
// }
// }
//
// function fruitMessage(input){
// console.log(`${input} are pretty cool!`);
// }