Prompt 202

Sandra Escalante
2 min readMay 30, 2021

What’s something that’s been confusing? How would you explain it to someone else?

Something that is confusing to me is how to write conditional statements. I get mixed up on the order and where to put all the data. If I was explaining conditionals, I would say that a conditional statement checks a specific condition and performs a task based on the conditions. It would be clear as mud!

What is “use strict”;? What are the advantages and disadvantages to using it?

The purpose of “use strict” is to indicate that the code should be executed in “strict mode”. With strict mode, you can not, for example, use undeclared variables. By changing errors to throw errors, strict mode removes certain JavaScript silent errors. Strict mode repairs mistakes that make it difficult for JavaScript engines to perform optimizations. However, a disadvantage is that it throws more errors and disables some features in an effort to make your code more robust, readable, and accurate.

Explain function hoisting in JavaScript.

Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution. Inevitably, this means that no matter where functions and variables are declared, they are moved to the top of their scope regardless of whether their scope is global or local.

Explain the importance of standards and standards bodies like ECMA.

The use of standards automatically makes every page you build genuinely cross-browser and cross-platform. ECMA stands for — European Computer Manufacturer’s Association. ECMAScript is a standard for a scripting language. It specifies the core features that a scripting language should provide and how those features should be implemented.

What actions have you personally taken on recent projects to increase maintainability of your code?

I have tried to comment a lot more. The comments range from notes to my future self and notes from the instructor.

Why is it, in general, a good idea to leave the global scope of a website as-is and never touch it?

Using global variables causes namespace pollution. This may lead to unnecessarily reassigning a global value.

--

--