
# Coaching - JavaScript 2
with Founders and Coders
---
## Daily learning
---
We believe it's important to build a habit of learning
---
The best way to do this is with small sessions every (working) day
---
### Active problem-solving
Warm up by writing some code before you start the day
(i.e. CodeWars or freeCodeCamp or a daily challenge)
---
### Passive learning
Finish the day by reading your code from earlier or reading an interesting article.
Try to take notes as you go to reinforce the learning.
(Dan likes [Anki](https://apps.ankiweb.net/) for turning notes into flashcards)
---
## Recap: Functions
----
### What is a function?
Some lines of code that do a predefined task. A function may take some input and return an output.
----
#### Writing a function
----
```javascript=
function addTwoNumbers(num1,num2){
return num1+num2;
}
var total = addTwoNumbers(2,3)
// total is assigned the returned value
```
----
What is structural? What is customisable?
----
#### Structure
```javascript=
function NAME (){
}
NAME();
// total is assigned the returned value
```
---
### Equality operators
----
We use Triple equals (`===`) or double equals (`==`) to check if two things are equivalent.
----
Triple equals checks for strict equality - whether two things are of the same type and value.
Double equals checks if things are the same value.
----
```javascript=
console.log("1" === 1);
// logs false
console.log("1" == 1);
// logs true
```
---
### If statements
----
_If statements_ allow us to define a condition to be met. When that condition is met, the code inside will run.
----
```javascript=
if (myNumber === 2){
console.log('The value is two, and the type is number');
};
```
---
## Practice
{"metaMigratedAt":"2023-06-15T20:14:31.102Z","metaMigratedFrom":"YAML","title":"Coaching - JavaScript 2","breaks":true,"slideOptions":"{\"theme\":\"white\"}","contributors":"[{\"id\":\"2967aacf-1990-431e-b963-91e79ce4a2bf\",\"add\":6932,\"del\":5065},{\"id\":\"0a41ac21-00a5-4d59-b808-37a29c6f6c98\",\"add\":1,\"del\":0}]"}