Tag: JavaScript
-
In JavaScript, what is the difference between `.contains()` and `.includes()`?
—
in GeneralIn JavaScript, .contains() and .includes() are used for different purposes: .contains(): This is a method of the Node interface in the Document Object Model (DOM). It’s used to check whether a node is a descendant of a given node, i.e., child, grandchild, etc. .includes(): This is a method of the Array and String prototypes in…
-
Difference between String Concatenation and String Interpolation
—
in GeneralString concatenation and string interpolation are both methods used in programming to create a new string from existing strings. However, they differ in syntax and ease of use. Below, I’ll explain each with examples: String Concatenation String concatenation is the process of appending one string to the end of another string. This is typically done…
-
The difference between .splice() and .slice()
—
in GeneralWhile perusing some forums, I ran into someone expressing not knowing the difference between .splice() and .slice() unless they googled it.
-
JavaScript String Cheat Sheet v2
—
in GeneralI was looking through the site for the old post, which was… less than helpful. Here’s the updated cheat sheet for quick reference.