#INCLUDE
Create For Community
Tech Cohort Workshop 3
INCLUDE
Agenda
In this workshop we will cover:
INCLUDE
INCLUDE
JavaScript Overview
What to Know
INCLUDE
We’ll be referring to these slides for:
https://www.w3resource.com/course/javascript-course.html#/
INCLUDE
Types: Primitive types and non-primitive types
Non-Primitive (Reference) Types
Primitive Types
Types
INCLUDE
MAKE SURE TO USE === and !== instead of == and !=
Booleans
2. let ❌ Sometimes use in React
Variable Declarations
1. const ✅ USE BY DEFAULT
3. var ❌ Don’t use in React
Variable Examples
INCLUDE
❌ var
❌ let
✅ const
INCLUDE
Objects
Objects hold properties by key
INCLUDE
Functions
INCLUDE
Functions
Function: Set of instructions meant to accomplish a certain task
Basic function syntax:
INCLUDE
Functions
INCLUDE
Another Example
INCLUDE
Arrow functions offer a way for us to inherit the this value from surrounding code, making it easier to maintain a predictable this binding:
Arrow vs Anonymous Functions
INCLUDE
HTML + Javascript
You can embed anonymous functions in Javascript into HTML with event handlers. They are used to make webpage elements interactive.
Click Me!
“Button was clicked”
INCLUDE
Methods
INCLUDE
Methods
Methods
For our purposes, we mainly want you to know filter() and map().
Best way to find them?
INCLUDE
The one we will be using the MOST is map.
Map: creates a NEW array by applying a provided function on every element in the array
It’s in the form:
array.map((elem) => function block)
We’ll show some examples
INCLUDE
Map Method
Methods - Filter
Filter syntax is similar to map, except it takes in a function that returns a boolean
Filter: creates a SHALLOW COPY of the array and filters it out based on a condition
It’s in the form:
array.filter((elem) => function block)
INCLUDE
INCLUDE
Import/Export & JSON
INCLUDE
Syntax: import (thing) from “module”;
Import
INCLUDE
Syntax: export (thing)/ export default (thing);
Export
INCLUDE
Language-agnostic format for storing data
JSON
INCLUDE
To create a JSON object:
More JSON!
INCLUDE
Hands-On JS Examples
INCLUDE
Thanks for Coming!!
See you next week and keep being awesome :)