@Demetrie415/

# Just testing/ practicing

## For practice

Files
• index.js
• Just practice.js
index.js
```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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
```
``` // // Objective: /* Challenge 3: Write your own For Loop that counts
// up by 20s from 1400 to 1600. Use an if/else statement
// inside your loop to log the counter alongside a "-low"
// when it's < 1500, a "-medium" when it's equal to 1500
// and a "-high" when the counter is > 1500.

// for ( var i = 1400; i <= 1600; i = i + 20) {
//   if ( i < 1500) {
//     console.log ( i + "-low");
//   }  else if ( i === 1500) {
//     console.log (i + "-medium");
//   }  else if ( i > 1500) {
//     console.log (i + "-high");
//   }
// }

// Example 2: Print every odd item in an array (using an if/else inside the loop)

// var anime = [ 'Naruto', 'Samurai Champloo', 'One piece', 'Inuyasha']
// console.log ( anime.length -1 )
// console.log ('--- EXAMPLE 1 ---' )

// for ( var index = 0; index < anime.length; index++)
// console.log (anime [index].toLocaleUpperCase() + '!')
// console.log ('---EXAMPLE 2---')
// for ( var index = 1; index < anime.length; index+= 2)
// console.log (anime [index])

// for ( var index = 0; index < anime.length; index++) {
//   if (index % 2 === 0) {
//     console.log (index + ':' + anime [index].toLocaleUpperCase() + '!' )
//   } else {
//     console.log (index + ' skipping odds ')
//   }
// }

// Keep going!! Never give up! PRACTICE MAKES PERFECT!

//  var anime = [ 'Naruto', 'Samurai Champloo', 'One piece', 'Inuyasha']
//push (adding at the end of an array)
//  console.log (anime.push ('Akame Ga Kill'))
//  console.log (anime)
// unshift (adding at the start of an Array)
//  console.log (anime.unshift( 'DBZ'))
//  console.log (anime)
// pop (Removing an element at the end of an array)
//  console.log (anime.pop())
//  console.log (anime.length)
//  console.log (anime.push ('Assassination classroom', 'bo bo bo, Bleach'))
//  console.log (anime)
//  console.log (anime.length)

// Start by making a BASIC array pattern
// var names = [ 'Mario', 'Freddie', 'Lisa', 'Kim']
// console.log (names)
// Now specifically identify an element within an Array
// console.log (names [1])
//Good job, now add a new element to an array by using the push method

// console.log (names.push ('Okoye'))
// console.log (names)
//now just add a NEW element without using the push method
// names [4]= 'Jones'
// console.log (names)
//Now use the POP method!!

// console.log (names.pop())
// console.log (names)
//Lets create a variable called Anime and have five objects within it

// var anime = [

//         {name:'Naruto', age: 16, village: 'Konoha' },
//         {name:'Sasuke', age: 17, village: 'Konoha' },
//         {name:'Naruto', age: 14, village: 'Konoha' },
//         {name:'Kakashi',age: 28, village: 'Konoha'},
//         {name: 'Kentotsuu', age: 21, village: 'Hidden Mist'},
//         {name: 'Rin', age: 17, village: 'Hidden Mist'}

// ]

// for ( var i = 0; i < anime.length; i ++ )
// currentAnime = anime [i]
// console.log (anime[4].name + ' Please bring ' + anime[5].name + ' with you to the leaf village. This is an order!')

// Arrays of Objects
// var cartoons = [

//   {name:'Looney tunes', creator: 'Tex Avery', aired: '1930' },
//   {name:'Dexters Lab', creator: 'Genndy K', aired: '1996' },
//   {name:'Johnny Bravo', creator: 'Van Partible' , aired: '1997' }

// ]
// console.log (cartoons)

//practice on object for challenge 2.3  (for Gods sake smh)
//Dot notation
// var colton  = { name: 'Colton', type: 'Dog', species: 'mountain cur', legs: 4, sound: 'Bark'}
// console.log (colton.name + "is a " + colton.species);
//another way to do it (Bracket notation)

// console.log (colton ['name'] + " has a loud " + colton['sound']);
//creating variable with objects

// var property = 'legs';
// console.log (colton.name + ' has ' +  colton[property] + " " + property)
//BIG one: how to UPDATE a value

// colton.age = 6
// console.log (colton)

// colton['age']= 7
// console.log(colton)

// var companies = [
//   { name: 'Apple', symbol: 'APPL', sharePrice: 147.06 },
//   { name: 'Tesla', symbol: 'TSLA', sharePrice: 316.83 },
//   { name: 'Google', symbol: 'GOOG', sharePrice: 942.63 },
//   { name: 'Facebook', symbol: 'FB', sharePrice: 149.64 }
// ]

function add ( num1, num2,) {
var total = num1 + num2;
}

//   funtion smaller (num1, num2, num3){
//     if (num1 < num2 &&  num1 < num3) {
//       return num1;
//   }
//    else if (num2 < num1 && num2 < num3) {
//     return num2
//   } else { return num3

//   }

// }

// console.log ('smallest (1,2,3): ' + smaller (1,2,3))

// Processing Arrays in Functions
// Write an addAll function that accepts an array of integers as inputs and returns the sum as an output

var total = 0
for (var i = 0; i < intergers.length; i ++){
total = total + intergers [i]
}