JSFiddle - React, Tailwind, and code Playground

by cjhaley

JavaScript

//'Debugging Challenge! Fork and complete!'

// ^ First Challenge ;)

//Challenge 2 (uncomment to evaluate)
var somevar = "this string";

//Challenge 3
//Output should be the result of 9 * 5

var myInt = 9;
myString = myInt * 5;
console.log(myString);


//Challenge 4
var myArray = ["string", 9, true];
console.log(myArray);


//Challenge 5
//use the array from above!
//Print the array items to the console

for(i = 1; i < myArray.length; i++) {
	console.log();
}

//Challenge 6
//Again using the array
//Alert the user

i = 0;
while (i < myArray.length) {
	console.alert(myArray[i]);
  i--;
}


//Challenge 6
//External functions
/*
//Must log a true or false to the console if the function succeeds or fails
console.log(messageFunction()); 

function messageFunction(someMessage) {
	if(someMessage) {
  	alert(someMessage);
  }else{
  	return false;
  }
  
}
*/

//Challenge 7
//Use an alert to ask the user for their name and year of birth
//Work out how old they are and alert them of their CURRENT age.
//No helpers on this one!