/******************************************************************************/
/* EXERCISE 1: Example exercise. The function below is an example
exercise to demonstrate how the rest of the exercises
work.
Calculate the sum of 1 and 2 then return the answer.
*/
function Exercise1() {
return 1 + 2;
}
console.group('Exercise 1');
console.assert(Exercise1() === 3);
console.groupEnd('Exercise 1');
/******************************************************************************/
// EXERCISE 2: Create (and return) a string with at least 5 characters
function Exercise2() {
//console.log('Hello stranger');
var name = 'Hello stranger';
//console.log (name.length)
return name;
// Your code here.
}
console.group('Exercise 2');
console.assert(Exercise2().length >= 5);
console.groupEnd('Exercise 2');
/******************************************************************************/
// EXERCISE 3: Create (and return) an array that has at least 5 elements
function Exercise3() {
var myArray = [1,3,5,6,7,8];
return myArray;
// Your code here.
}
console.group('Exercise 3');
console.assert(Exercise3().length >= 5);
console.groupEnd('Exercise 3');
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.