JSFiddle - React, Tailwind, and code Playground

by Denis Yevseyev

HTML

<h1>Primitives Exercise</h1>

JavaScript

/******************************************************************************/
/* 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');