Join Carl Peaslee for an in-depth discussion in this video Limitations of const and let, part of React: ES6, ES2016, and Beyond.
- [Instructor] As I mentioned at the end of the last video,…one of the main things we think about…with constAndLet is that we think…const, this is a constant, it's not going to change;…and Let, this is something that might change,…it could change.…Let's explore a little bit what that means…because this is actually a gotcha in some cases.…So, be careful, const isn't actually an immutable variable,…it can be changed.…Let's look at some code to see what happens.…I'm going to make sure the everything's commented out here.…And then, I'm going to scroll down to the bottom,…where I have some code that I want to look at.…
I'm going to declare a constant,…and I'm going to call this canIChangeThis,…and I'm just going to make it a string,…and I'm going to set is to…What is this variable?…And then, in my console,…I'm going to log it…and then, beneath it, I'm going to try and change it.…
And then, I'm going to console.log,…the variable once again to see if I was, in fact,…able to change this.…I'll save the file, and I'll go to my browser.…
- Using const and let
- Importing and exporting modules
- Arrow functions
- Destructing assignments
- Arguments and template literals
- Extended parameter handling with the spread operator
- Generating custom styles
- Classes, getters and setters
Skill Level Intermediate
1. Variables and Declarations
2. Arguments and Template Literals
4. Promises and Async
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.