function statement code example
Example 1: function
funcion name_of_funtion(){
}
Example 2: simple javascript function
function idk() {
alert('This is an alert!')
}
//call the function to make the function run by saying "Name of function + ()"
idk()
Example 3: function
function linearSearch(value, list) {
let found = false;
let position = -1;
let index = 0;
while(!found && index < list.length) {
if(list[index] == value) {
found = true;
position = index;
} else {
index += 1;
}
}
return position;
}