This file contains hidden or 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
// < Hacking Task #warmUp >"); | |
var battery = 100; //how much battery your laptop has left | |
var hackedTerminals = 0; //how many terminals you have hacked | |
var username = prompt('What is your username:', 'username here...'); | |
var welcomeMessage = | |
'fSociety distro is booting... Please enter your username: '; | |
console.log(welcomeMessage + username); |
This file contains hidden or 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
/* | |
//Les variables | |
//commande prompt | |
var name = prompt("what is your name?"); | |
alert(name); | |
//Strings | |
console.log('What a "String" is?'); | |
console.log("What a \"String\" is?"); | |
console.log("What a 'String' is?"); |
This file contains hidden or 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
/* | |
function Person(first,last,age) { | |
this.firstname = first; | |
this.lastname = last; | |
this.age = age; | |
var bankBalance = 7500; | |
var returnBalance = function() { | |
return bankBalance; |
This file contains hidden or 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
Empty file |
This file contains hidden or 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 myAge = 39; //my age in years | |
let earlyYears = 2; | |
earlyYears *= 10.5; //21 | |
let laterYears = myAge - earlyYears; //18: subtracts the first two years from my age | |
laterYears *= 4; //72: calculate the nbr of dog years accounted for by my later years | |
let myAgeInDogYears = earlyYears + laterYears; // my age in dog years | |
const myName = 'David'; | |
myName.toLowerCase(); //make all letters in my name lowercase | |
console.log(`My name is ${myName}. I am ${myAgeInDogYears} years old in dog years.`); //print out to the console my age in dog years |
This file contains hidden or 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 getSleepHours = day => { | |
day = day.toLowerCase(); | |
switch (day) { | |
case 'monday': | |
return 7; | |
break; | |
case 'tuesday': | |
return 6; | |
break; | |
case 'wednesday': |
This file contains hidden or 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 input = 'I am learning JavaScript!'.toLowerCase(); | |
const vowels = ['a', 'e', 'i', 'o', 'u']; | |
let resultArray = []; | |
for (let i = 0; i < input.length; i++) { | |
for (let j = 0; j < vowels.length; j++) { | |
if (input[i] === vowels[j]) { | |
resultArray.push(input[i]); |
This file contains hidden or 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 cards = ['Diamond', 'Spade', 'Heart', 'Club']; | |
let currentCard = 'Heart'; | |
while (currentCard !== 'Spade') { | |
console.log(currentCard); | |
let randomNumber = Math.floor(Math.random()*4); | |
currentCard = cards[randomNumber]; | |
} |
This file contains hidden or 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
// Verifies the password has a special character | |
function hasSpecialCharacter (input) { | |
const specialCharacters = ['!', '@', '#', '$', '%', '^', '&', '*']; | |
for (var i =0; i <input.length; i++) { | |
for (var j =0; j <specialCharacters.length; j++) { | |
if (input[i] === specialCharacters[j]) { | |
return true; | |
} | |
} | |
} |
This file contains hidden or 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
/* | |
* Programming Quiz: 99 Bottles of Juice (4-2) | |
* | |
* Use the following `while` loop to write out the song "99 bottles of juice". | |
* Log the your lyrics to the console. | |
* | |
* Note | |
* - Each line of the lyrics needs to be logged to the same line. | |
* - The pluralization of the word "bottle" changes from "2 bottles" to "1 bottle" to "0 bottles". | |
*/ |
NewerOlder