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
| var n = Math.random(); | |
| n = n * 6; | |
| // n = n.toFixed(); | |
| // var num = n.toFixed(2); | |
| var num = Math.floor(n); | |
| if (num < 5){ | |
| console.log(num + " es menor que 5") |
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
| var numberOfBottles = 3; | |
| var count = 1; | |
| while (numberOfBottles >= count) { | |
| var bottleWord = "bottle"; | |
| if (numberOfBottles === 1) { | |
| bottleWord = "bottles"; | |
| } | |
| console.log(numberOfBottles + " " + bottleWord + " of beer on the wall"); | |
| console.log(numberOfBottles + " " + bottleWord + " of beer,"); |
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
| var output = []; | |
| var count = 1; | |
| function fizzbuzz(){ | |
| if(count % 3 === 0 && count % 5 === 0){ | |
| output.push("FizzBazz"); | |
| } |
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 HouseKeeper (experience, name, clean){ | |
| this.experience = experience; | |
| this.name = name; | |
| this.clean = clean; | |
| } | |
| var HouseKeeper1 = new HouseKeeper (9, "Tom", ["Bedroom", "Lobby"]); | |
| console.log(HouseKeeper1.name); |
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
| var guestList = ["Jhon", "Rawad", "Angela", "Kinan"]; | |
| var guestName = prompt("Cual es tu nombre"); | |
| var primeraLetra = guestName.slice(0 , 1); | |
| var mayuscula = primeraLetra.toUpperCase(); | |
| var restName = guestName.slice(1, guestName.length); |
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 bmiCalculator (weight, height) { | |
| var interpretation = weight / Math.pow(height, 2); | |
| return Math.round(interpretation); | |
| } | |
| var body = bmiCalculator(85,1.8); | |
| if(body < 18.5 ){ | |
| console.log("your weight is: " + body + " You are underweight"); | |
| } |
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 sayHello(to){ | |
| // console.log("Hello " + to) | |
| // } | |
| // sayHello("Jhon"); | |
| function otroevento(typeOfEvent, callback){ | |
| var eventthatHappened = { | |
| eventType: "keypress", | |
| key: "p", |
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 lifeInWeeks(age) { | |
| /************Don't change the code above************/ | |
| var age = prompt ("cual es tu edad?"); | |
| var year = prompt ("año a calcular?"); | |
| var weeks = 52; | |
| var days = 365; |
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
| var output = []; | |
| var count = 1; | |
| function fizzbuzz(){ | |
| if(count % 3 === 0 && count % 5 === 0){ | |
| output.push("FizzBazz"); | |
| } |
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 fibonacciGenerator(n) { | |
| var output = [] | |
| if (n === 1){ | |
| output = [0]; | |
| } | |
| else if(n === 2){ | |
| output = [0, 1]; | |
| } | |
| else{ | |
| output = [0, 1]; |
OlderNewer