Skip to content

Instantly share code, notes, and snippets.

View kbk0125's full-sized avatar

Kevin Kononenko kbk0125

View GitHub Profile
@kbk0125
kbk0125 / daysVar.js
Last active December 20, 2017 00:56
let days = 7;
days = 5;
console.log(days)
// 5
function unitedStates(){
let drinkingAge = 21;
}
function passDrinkingLaw(){
drinkingAge = 18;
// this would throw an error
}
passDrinkingLaw();
function unitedStates(){
let drinkingAge = 21;
function passDrinkingLaw(){
drinkingAge = 18;
// when this function runs, it changes the
//variable for the whole united states function
}
}
function unitedStates(){
let drinkingAge = 21;
let state = 'massachusetts';
if(state == 'massachusetts'){
let closingTime= '2AM';
console.log(drinkingAge) //21
console.log(closingTime) // 2AM
}
function unitedStates(){
let drinkingAge = 21;
let state = 'massachusetts';
if(state == 'massachusetts'){
let closingTime= '2AM';
console.log(drinkingAge) //21
}
console.log(closingTime) //undefined
function unitedStates(){
let drinkingAge = 21;
}
function mexico(){
let drinkingAge = 18;
console.log(drinkingAge) //18
}
console.log(drinkingAge)
const unLawOne = 'Slavery is prohibited';
const unLawTwo = 'Chemical weapons are prohibited';
function unitedStates() {
let drinkingAge = 21;
console.log(drinkingAge) // 21
console.log (unLawOne) // Slavery is prohibted
}
console.log(drinkingAge)
function unitedStates(){
let drinkingAge = 21;
}
const unLawOne = 'Slavery is prohibited';
const unLawTwo = 'Chemical weapons are prohibited';
var unLawOne = 'Slavery is prohibited';
var unLawTwo = 'Chemical weapons are prohibited';