In early 2018, The Guardian, a British newspaper and online publication, switched its 2.3m content items from MongoDB to PostgreSQL.
Why did they switch? What would they do differently today?
In July 2015, a massive heatwave struck London, with the unusual consequence of The Guardian switching from MongoDB to PostgreSQL just three years later.
At the time, The Guardianās data was in a standard NoSQL database; MongoDB stored locally at Guardian Cloud, the data center in the basement of The Guardianās office near Kings Cross.
While writers for The Guardian were live-blogging about the heat, developers at The Guardianā¦
The Pragmatic Programmers put their entire collection of textbooks about software development and web development on Medium this week.
Is this a good thing or a bad thing for web developers?
My favorite titles from the list:
I counted 142 books in the collection. Thatās a ton of content.
As I commented on HackerNews, I think this is a great opportunity for programmers to be able to find a lot more answers through organic search.
Previously youād have to know that the topic wasā¦
""
as an argument to the array .join()
method.When you call JavaScriptās .join()
(Array.prototype.join()
) method with no argument, youāre actually using a comma.
The default behavior of .join()
is to convert an array to a string with commas, so itās the same as calling .join(",")
explicitly.
When you call .join(",")
you specify that you want a string literal ","
to be the separator character, which will occur between each element. But itās the same as .join()
with no argument at all.
If you call .join("")
with the empty string ""
instead, then all of the elements will be joined together without commas.
Stackbit just released their pricing plans for their Jamstack āinstant siteā service, which I love and have written about before:
My initial impression is that thereās a lot of value for anyone making websites in a small team. Is it enough to make the $29 and $149 price points attractive for teams of 4 users and 10 users respectively?
Iāll still use Stackbitās free tier any time. I mean thereās literally a Create Site button on the excellent Jamstack Themes site:
let
and const
as alternatives to var
for declaring variables in JavaScript. Because const
is not hoisted to the top of the execution context in the same way var
is, const should be faster, right?The first lecture in Tyler McGinnisās Advanced JavaScript course covers execution context and hoisting, and it got me wondering about instantiating variables using var
and const
in JavaScript.
After the lecture, I was left thinking that the JavaScript keyword var
might be slower than the keyword const
, because var
needs to be hoisted.
Perhaps that extra step in the execution context hurts performance. If so, we would also expect to find that let
is slower than var
.
(If youāre not sure about the difference between each of these keywords for declaring variables, Iāve previously compared let
, var
, and const
).
.
dot syntax or []
bracket notation. Hereās why there are two property accessors and what the difference is between them.One of the first things JavaScript developers learn is that there is a difference between primitive types (like numbers and booleans) and objects (like arrays and Dates
).
You typically recognize objects because they are invoked with the object literal syntax ({}
, curly brackets) and then accessed using a single period character, the .
dot syntax.
Calling the .
dot syntax is what is called an object property accessor, as it allows you to access the specified property.
āProperty accessors provide access to an objectās properties by using the dot notation or the bracket notation.ā ā MDN Docs
Object properties areā¦
{}
to declare objects in JavaScript. Writing out a new object this way is called creating an object literal, which means curly braces {}
are the object literal syntax.In JavaScript, there are a bunch of ways to make new objects, but we almost always use the object literal syntax, {}
.
āObjects can be initialized using
new Object()
,Object.create()
, or using the literal notation (initializer notation). An object initializer is a comma-delimited list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ({}
).ā ā MDN Docs
When we write curly brackets {}
, we create an empty object with no properties, which is the same as calling the Object()
constructor with the new
keyword: new Object() // same as {}
.
Weā¦
JavaScript objects are collections of key-value pairs, where each object key (also called object property) has a specific value.
Object keys are strings (or symbols), but values can be all different types, including arrays and objects.
If you need to use any primitive type (or object reference) as the object key, you should use a Map
instead of an object.
We typically write JavaScript object properties using camelCase, without spaces, but you can use spaces in keys if you prefer. Just be sure to include quotation marks to specify the string youāre using as the object key.
Hereās a codeā¦
Out there applying for a web developer job? It never hurts to ask your friends if their companies are hiring. But how do you actually make a positive impression on the hiring manager?
All companies want you to answer the question, āWhy should we hire you?ā For web developers, that means demonstrating real-world technical skills before you even get to the interview.
Here are 10 great tips to help you land your next position.
Tried and true, adding a new portfolio project is a great way to buff up your real skills at the same time as you show themā¦
{}
seems self-obvious: there are no user-defined object properties (also called object keys). But how exactly do you check if an object is empty in JavaScript?{}
Have Length 0?Unlike arrays, generic JavaScript objects have no .length
method to check for the number of entries (object key-value pairs).
That means knowing whether you have an empty object {}
is not an obvious task ā how do you check an objectās ālengthā?
Here are 4 methods to check whether a JavaScript object is an empty object, meaning it is empty of object keys (object properties).
.length
of an Array of Object.keys()
.length
of Object.getOwnPropertyNames()
for...in
loop with .hasOwnProperty()
Iāll include short JavaScript code examplesā¦
š¤ The physical therapist who writes JavaScript šŖ Web Developer š Mentor š§ DPT š SEO Expert š React š Jamstack š¬ Ask me anything š DoctorDerek.com š