JSFiddle - React, Tailwind, and code Playground
by iboulder
HTML
<h1>
Exercise set 2
</h1>
JavaScript
/**
* Exercise:
* Get to know your data types and variables
*
* Follow the directions below but feel free to experiment and veer off course.
* Work in the console directly OR use "console.log()" to output to the console from the script.
*/
// 1)
// Declare 2 to 5 variables (name them as you like)
// Make at least one string, one number and one boolean.
// Log the typeof each to the console
console.group('ex 1');
console.log('excersie 1');
console.log(typeof("sheryl"));
console.log(99);
console.log(true);
console.groupEnd('ex 1');
// 2)
// Declare a new variable that stores the result of a mathematical expression
// You can add/multiply/divide/modulo any set of numbers
// Log the result to the console
console.group('ex 2');
var x = 0;
x += 22
console.log('x is ' + x)
console.log('x /2 is ' + x/11);
console.groupEnd('ex 2');
// 3)
// Combine at least three strings together
// Log the result to the console
console.group('ex 3');
var sentance = "";
sentance = "sheryl" + " is " + "learning" + " something new"
console.log(sentance);
console.groupEnd('ex 3');
// 4)
// Create an array with at least 5 values stored inside
// Log the result to the console
// save some typing
//console.group('ex x');
//console.log('something')
//console.groupEnd('ex x');
console.group('ex 4');
console.log(myArray =[3,4,5,6,7]);
console.groupEnd('ex 4');
// 5)
// Use Array.prototype.concat to add another array to your original array
// e.g. var arr3 = arr1.concat(arr2);
// Log the result to the console
console.group('ex x');
var myArray2 = [100,101,102];
var myArrayCatted = myArray.concat(myArray2);
console.log('something')
console.groupEnd('ex x');
// 6)
// Create an object literal that represents a person (perhaps you!)
// Define several properties within the object (name, hairColor, age, etc..)
// Define at least one proprety that references an array
// favColors, siblings, etc...
// Log the object to the console
// And Log just "name" property to the console
//...