From the course: JavaScript: Best Practices for Data

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Foundational practice: Always use strict mode

Foundational practice: Always use strict mode - JavaScript Tutorial

From the course: JavaScript: Best Practices for Data

Start my 1-month free trial

Foundational practice: Always use strict mode

- [Instructor] No matter which other practices are in your style guide or what modern JavaScript features you may be using, your first step when writing code should be to ensure that you're working in strict mode. Indicating that code should be interpreted in strict mode specifies to user agents like browsers that they should treat code literally as written and throw an error if the code doesn't make sense. Without strict mode turned on. user agents often go through a series of modifications to problematic code in an attempt to get it to make sense. In the start files for this video, I'm going to create and then log a variable. My idea is to build an app to get a user's location and identify nearby events. And I'll use const for my variable just for a placeholder location, and then I'll console that log it. So const city equals Chicago and console.log city. And I'll save that, I'll switch to my HTML file, and I'll run…

Contents