Skip to content

Instantly share code, notes, and snippets.

@sielay
Created March 15, 2018 20:47
Show Gist options
  • Save sielay/4e0346a7c191ac45da36f345de9b5389 to your computer and use it in GitHub Desktop.
Save sielay/4e0346a7c191ac45da36f345de9b5389 to your computer and use it in GitHub Desktop.
Basic JS tasks for my baby based on JavaScript for Kids book

String

var pokemon = "tHiS iS pOkEmOnCaSe";
// expected "This is pokemoncase.";
var yuliay = "yuliya";
var lukasz = "łukasz";
// expected "Yuliya i Łukasz";

Number

var a = 1;
var c = ... // a should be equal 2 and c equal 1
var b = 4;
b ... // b should be equal half of previous value
var a = 3;
var b = 4;
var c = 7;
var average = ... // should be equal equal value from a, b and c

Boolean

var dayOfWeek = 2; // Monday is 0 and Sunday 6 - test for all values
var isMerkatDay = // true if dayOfWeek is Tuesday or Wednesday
var isLotteryToday = // true if it's Wednesday or Saturday 
var goToMorrisons = // true when it's merkat day and lotery day
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment