Skip to content

Commit 3da72f2

Browse files
committed
Conditionals
1 parent 11a7e8b commit 3da72f2

10 files changed

+27
-47
lines changed

.idea/.gitignore

-5
This file was deleted.

.idea/basic-js-platzi.iml

-12
This file was deleted.

.idea/modules.xml

-8
This file was deleted.

.idea/vcs.xml

-6
This file was deleted.

conditionals.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let age = 24
2+
3+
if (age > 18) {
4+
console.log("You are old enough to vote.")
5+
} else if (age === 18) {
6+
console.log("It is the first time you are going to vote, think about it!")
7+
} else {
8+
console.log("You cannot vote yet.")
9+
}

functions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function myFunc() {
44
}
55

66
// Expressive function
7-
let mySecondFunc = function (a, b) {
7+
var mySecondFunc = function (a, b) {
88
return a + b;
99
};
1010

methods.js

-5
This file was deleted.

operators.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function myMaths(first_num, second_num) {
2+
sum = first_num + second_num
3+
rest = first_num - second_num
4+
multiply = first_num * second_num
5+
divide = first_num / second_num
6+
7+
console.log(sum,rest,multiply,divide)
8+
}
9+
10+
myMaths(280,29)

other_functions.js

-5
This file was deleted.

variables.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
const username = "UltiRequiem"; // Declare and initialize in the same line
2-
let age; // Declare
1+
var username = "UltiRequiem"; // Declare and initialize in the same line
2+
var age; // Declare
33
age = 14; // initialize
44

5-
let me = {
5+
var me = {
66
name: "Eliaz",
77
age: 14,
88
};
99

10-
const hobbies = ["Code", "Music", "Anime", "Manga", "Maths"]; // Arrays
10+
var hobbies = ["Code", "Music", "Anime", "Manga", "Maths"]; // Arrays
1111

1212
// Print in console
1313
console.log(`Hi! My name is ${username} and I'm ${age} years old.`)
1414

1515
console.log("Some of my hobbies are:");
1616
// For
17-
hobbies.forEach((hobbie )=> console.log(`- ${hobbie}`))
17+
for (let i = 0; i < hobbies.length; i++) {
18+
console.log("- " + hobbies[i]);
19+
}

0 commit comments

Comments
 (0)