JSFiddle - React, Tailwind, and code Playground

by ShaikBasha

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() {

  return "hello";

}

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() {

  return [1,2,3,4,5]

}

console.group('Exercise 3');
console.assert(Exercise3().length >= 5);
console.groupEnd('Exercise 3');