diff --git a/01-Fundamentals-Part-1/final/index.html b/01-Fundamentals-Part-1/final/index.html index 96fbc80614..f9b3434078 100755 --- a/01-Fundamentals-Part-1/final/index.html +++ b/01-Fundamentals-Part-1/final/index.html @@ -1,31 +1,31 @@ - - - - - JavaScript Fundamentals – Part 1 - - - -

JavaScript Fundamentals – Part 1

+ + + + + JavaScript Fundamentals – Part 1 + + + +

JavaScript Fundamentals – Part 1

- - + + diff --git a/01-Fundamentals-Part-1/starter/app.js b/01-Fundamentals-Part-1/starter/app.js new file mode 100644 index 0000000000..88ba73e947 --- /dev/null +++ b/01-Fundamentals-Part-1/starter/app.js @@ -0,0 +1,26 @@ +// // Type Conversion and coercion +// const inputYear = "1991"; +// console.log(Number(inputYear), inputYear); +// console.log(Number(inputYear) + 18); + +// console.log(Number("Wilfred")); +// console.log(typeof NaN); + +// console.log(String(23), 23); + +// // type coercion +// console.log("I am " + 23 + " years old"); + +// console.log("23" - "10" - 3); +// console.log("23" + "10" + 3); + +// 21. Truthy and Falsy Values + +console.log(Boolean(0)); +console.log(Boolean(undefined)); +console.log(Boolean("Wilfred")); +console.log(Boolean({})); +console.log(Boolean("")); + +const myHeading = document.querySelector("h1"); +myHeading.textContent = "Hello World"; diff --git a/01-Fundamentals-Part-1/starter/index.html b/01-Fundamentals-Part-1/starter/index.html index 59529c7923..1f400d26c3 100755 --- a/01-Fundamentals-Part-1/starter/index.html +++ b/01-Fundamentals-Part-1/starter/index.html @@ -1,29 +1,31 @@ - - - - - JavaScript Fundamentals – Part 1 - - - -

JavaScript Fundamentals – Part 1

- + + + + + JavaScript Fundamentals – Part 1 + + + +

JavaScript Fundamentals – Part 1

+ + + diff --git a/02-Fundamentals-Part-2/starter/script.js b/02-Fundamentals-Part-2/starter/script.js index e69de29bb2..1542839cea 100755 --- a/02-Fundamentals-Part-2/starter/script.js +++ b/02-Fundamentals-Part-2/starter/script.js @@ -0,0 +1,45 @@ +function logger() { + console.log("My name is Wilfed"); +} + +// calling / running/ invoking function +logger(); + +function fruitProcessor(apples, oranges) { + console.log(apples, oranges); + const juice = `Juice with ${apples} apples and ${oranges} oranges.`; + + return juice; +} + +function fruitProcessorOutput(apples, oranges) { + console.log(apples, oranges); + const juice = `Juice with ${apples} apples and ${oranges} oranges.`; + + return juice; +} + +fruitProcessor(5, 0); // these actual values here of the parameters are called the arguments. + +const showJuices = fruitProcessorOutput(5, 0); + +console.log(showJuices); + +// ============ my own function ====================== +function carBrands(Toyota, Ford) { + const cars = `Top notches cars are ${Toyota} & ${Ford}`; + return cars; +} + +const displayCars = carBrands("Lexus", "Tesla"); +console.log(displayCars); + +const displayCars2nd = carBrands("Bogatti", "Honda"); +console.log(displayCars2nd); + +// create a generic function that will reusable +// benefit in craeting a function is reusable +// not all the time a function return a function +// example ani na use case naa sa mga component like sa styling karon mao akoang na notice +// importante kaayo masabatan nako ang detailed ani concept sa function +// DRY code = dont repeat yourself