This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const speedOfLight=299792458; //m*s-1 | |
try { | |
speedOfLight=300; // this is not true! | |
} catch(error) { | |
console.log(error); // TypeError: Assignment to constant variable. | |
// Note - error messages will vary depending on browser | |
} | |
console.log(speedOfLight); // Expected output 299792458 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let date = new Date("2015–01–01"); | |
let region = "US"; | |
// Some were further in the code | |
if (region === "US") { | |
let date = new Date(); | |
console.log("New date", date); // We get the current date as expected | |
} | |
console.log(date); //We get 2015–01–01T00:00:00.000Z as expected :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var date = new Date("2015–01–01"); | |
var region = "US"; | |
// Some were further in the code | |
if (region === "US") { | |
var date = new Date(); | |
console.log("New date", date); // We get the current date as expected | |
} | |
console.log(date); //Expecting 2015–01–01T00:00:00.000Z but we get the current date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<link rel="stylesheet" href="css/uikit.min.css" /> | |
</head> | |
<body> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> |
NewerOlder