By default, JavaScript has a sort function that takes the form of yourArrayName.sort( ) built-in, but to sort JavaScript arrays ascending and descending, you need a custom compare function to sort numeric values. .sort() will work fine for strings since it sorts by the first character only, so Alpha will come before Beta, but when Read post
{
"@timestamp": "2022-01-29T15:55:40+00:00",
"slug": "/sort-javascript-arrays-ascending-descending",
"post_type": "post",
"@tags": [],
"@categories": [
"All",
"JavaScript"
],
"excerpt": "By default, JavaScript has a sort function that takes the form of yourArrayName.sort( ) built-in, but to sort JavaScript arrays ascending and descending, you need a custom compare function to sort numeric values. .sort() will work fine for strings since it sorts by the first character only, so Alpha will come before Beta, but when […]"
}
Today we’re taking a look at some useful array and object methods for JavaScript. Throughout this entire post, we’re going to be using this object named books of, you guessed it, book objects to test out some methods: Filter method If we want to see only books rated 3-stars and up, we can use the Read post
{
"@timestamp": "2022-03-26T14:17:46+00:00",
"slug": "/javascript-array-methods",
"post_type": "post",
"@tags": [],
"@categories": [
"All",
"JavaScript"
],
"excerpt": "Today we’re taking a look at some useful array and object methods for JavaScript. Throughout this entire post, we’re going to be using this object named books of, you guessed it, book objects to test out some methods: Filter method If we want to see only books rated 3-stars and up, we can use the […]"
}
You can think of The Document Object Model (DOM) as a tree with branches of nodes. The DOM is what the browser creates to display the content on your screen. There are 12 different types of nodes and they may have children nodes of their own. Once you know how to grab parts of the Read post
{
"@timestamp": "2022-04-01T13:50:56+00:00",
"slug": "/query-the-dom-with-javascript",
"post_type": "post",
"@tags": [],
"@categories": [
"All",
"JavaScript"
],
"excerpt": "You can think of The Document Object Model (DOM) as a tree with branches of nodes. The DOM is what the browser creates to display the content on your screen. There are 12 different types of nodes and they may have children nodes of their own. Once you know how to grab parts of the […]"
}
There are 12 different node types and each node may or may not have its own children of different node types. Node types can be thought of as communication protocols and essentially define how each node communicates with other nodes. There’s no point in memorizing them all, and a good reference to keep on hand Read post
{
"@timestamp": "2022-04-05T14:21:04+00:00",
"slug": "/how-to-check-dom-nodetypes",
"post_type": "post",
"@tags": [],
"@categories": [
"All",
"JavaScript"
],
"excerpt": "There are 12 different node types and each node may or may not have its own children of different node types. Node types can be thought of as communication protocols and essentially define how each node communicates with other nodes. There’s no point in memorizing them all, and a good reference to keep on hand […]"
}
The DOM is like a tree of elements. For example, you have some nodes that are nested inside each other, and they kind of branch off. A node nested inside another node is a child, and the node with elements nested under it is a parent. Here’s an example of some HTML where we can Read post
{
"@timestamp": "2022-04-07T14:04:28+00:00",
"slug": "/how-to-traverse-the-dom-with-javascript",
"post_type": "post",
"@tags": [],
"@categories": [
"All",
"JavaScript"
],
"excerpt": "The DOM is like a tree of elements. For example, you have some nodes that are nested inside each other, and they kind of branch off. A node nested inside another node is a child, and the node with elements nested under it is a parent. Here’s an example of some HTML where we can […]"
}
Jest is a JavaScript testing framework maintained by Meta. It works with Bable, TypeScript, Node.js, React, and more. In this case, we’re going to set up Jest and test a JavaScript function. How to Install & Set Up Jest You can refer to the step-by-step instructions via the official Getting Started documentation, but our simple Read post
{
"@timestamp": "2022-09-25T19:48:46+00:00",
"slug": "/javascript-unit-testing-with-jest",
"post_type": "post",
"@tags": [],
"@categories": [
"All",
"JavaScript"
],
"excerpt": "Jest is a JavaScript testing framework maintained by Meta. It works with Bable, TypeScript, Node.js, React, and more. In this case, we’re going to set up Jest and test a JavaScript function. How to Install \u0026 Set Up Jest You can refer to the step-by-step instructions via the official Getting Started documentation, but our simple […]"
}