Logic in JS
- Create conditionals and use iteration in JS
- Logic: (as defined in the Oxford dictionary) reasoning conducted or assessed according to strict principles of validity
- Conditionals: conditions that have to be met in order for code to be executed (e.g. if statements)
- Itterations:
Action in JS
Why use functions?
- makes our code reusable
- allows us to compartmentalise our code
- allows ud to work asynchronously
What ae the three sources of function? -create our functions ourselves -inbuilt methods that we can access on any js file (e.g. forEach, sum, reduce, filter) -imported functions (such as jest from npm)
different ways to write a function
- es6 arrow function
- function keywords use
recursion
- the function call itself
publishing an npm package (Jaden Case Strings - capitalised every letter of every word in the sentence )
- in the package.json change the main to main.js (the file where the function is) and add npm version 1.0.0
- then run npm plublish in the terminal
- find the generated link for publishing and check it
We now know how to use array methods but what about number and string methods?