I believe that one of the first and foremost reasons people struggle to understand hoisting is because the term itself is somewhat misleading. The Merriam-Webster definition of the word hoist is “an act of raising or lifting”.
This might lead one to assume that hoisting involves written code being physically rearranged somehow. This is not true.
I started with a basic HTML skeleton:
I then filled in this HTML skeleton with what I felt my project would need:
I wanted to have my “Etch-A-Sketch” grid take up the right half of my page with the title and interactive elements sitting on…
You know them, you love them, and you probably use them all the time! Introduced as part of the ECMAScript 6 update in 2015, arrow functions exploded in popularity, and with good reason. Arrow function syntax is wonderful syntactic sugar that removed the need for the following:
this keyword, because sometimes all you really need is an anonymous function.
All that being said, arrow functions are not a one-size-fits-all solution for…
In computer science, the type of structures that we constantly build and use are called data structures.
A data structure is a storage format created for the purpose of storing and organizing data, often prioritizing the accessibility and customization of that data. In other words:
“More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.” -Wikipedia
Not an official title, but MDN does have a page dedicated to the term.
Is avoiding slop enough reason to employ strict mode? Only you…
These operators can be further defined as either unary or binary. Let’s break down the difference between these two terms now as we move toward understanding ternary.
A unary operator takes just one operand, either before or after the operator:
operator operand || operand operatorfor example:x++ || ++x
A binary operator requires two operands, the most common examples being basic addition, subtraction, multiplication, and division:
operand operator operandx + y; || x - y; || x * y; || x / y;
undeclared when writing code, instead, we encounter the error message that is produced when we try to use an undeclared variable.
console.log(aVariable) // ReferenceError: aVariable is not defined
When we try to use a variable that has not been declared using either of the keywords
const, this usage will result in the above error message.
Ironically, this error message reveals the first slightly confusing scenario we’re looking at today: the data type of an undeclared variable is
undefined is one of seven…
We begin with
parseInt() which takes two arguments, a string and a radix. The function returns an integer parsed from the given string.
If the first argument is not a string, it is converted to one automatically using
ToString(). Either way, any leading whitespace is ignored.
parseInt() method starts at position 0 and determines…
As human beings, we’re genetically programmed to anthropomorphize. To anthropomorphize is “to attribute human form or personality to things not human.” It’s a complicated, not entirely understood instinct that may have helped our ancestors spot familiar friends or hidden enemies. This is part of why we see silly faces in the clouds and spooky faces in the dark.
Unfortunately, for some of us (including yours truly), this means that when struggling to learn a new subject, we can subconsciously humanize said subject. When I struggle with code, I start to think of code as an enemy, as something that’s out…
These days, I am actively applying to and interviewing for jobs. Maybe you are too, dear reader.
A few days ago, I had an interview in which the engineering team asked me to explain what a closure is. It’s certainly not the first time that I’ve been asked about the term, but I’m not going to lie, I panicked a bit.
Closures have developed something of an infamous reputation for being an impossibly difficult screening question.
After the interview, I was frustrated that the topic was still daunting to me. I was determined to buckle down and defeat closure once…
Web Developer, writer, bookworm, viewer of indie films. Passionate about problem-solving and building a more equitable -and joyful- world. Actively job seeking.