Declare a variable isCat to a negative Boolean value
var isCat = false;
1. Write a function called outputToConsole that outputs to the console “Morris is a cat” 2. Call the function
function outputToConsole(){
console.log("Morris is a cat");
}
outputToConsole();
1. Write a function called ouputToConsole2 that takes the parameter ‘name’ and outputs the name to console in a sentence. 2. Call the function with a string parameter.
function outputToConsole2(name){
console.log("The name you entered was " + name);
}
outputToConsole2("Tiger");
1. Write a function called nameAndAge that takes 2 parameters ‘name’ and ‘age’ and outputs them in a sentence 2. Call the function with a string and number parameter
function nameAndAge(name, age){
console.log(name + " is age "+ age);
}
nameAndAge("Auston Matthews",20);
Declare an array fruits with 6 fruits
var fruits = ["mango","papaya","passion fruit","dragon fruit","lychee","nashi"];
Output the length of the fruits array;
console.log(fruits.length);
Write a for loop that outputs each fruit in the array in a sentence
for (var i=0;i<fruits.length;i++){
console.log("the name of the fruit at this index is "+fruits[i]);
}