Array like objects and Arrays are Objects in JavaScript examples and explanations.

In core javaScript Arrays are technically not Arrays, but Objects, that is that an array is a kind, or class of an object.

The thing about Arrays that are made with the core js Array constructor, or literal syntax, is that they are a special kind of object in which the objects constructor name is Array. This also means there there are a bunch of array prototype methods that can be used with that instance of Array also. However there are also array like objects in addition to Arrays. What this means is that if any object contains a length property that has a value that is a number from 0 to the max safe integer, then it is “Array like” and can be used with methods that act on arrays. If you are confused then in this post I will try to help reduce some of this confusion, and of course it will be best for you to just work out some examples of your own when it comes to learning by doing.

Read More

A very nice option parser for Node.js called nopt

So you find yourself writing some kind of Command Line Interface tool with node.js, and as such you want to make it so it will accept some arguments from the command line. So you want something that works just like that of many other CLI tools that you may be familiar with if you are somewhat POSIX or powerShell savvy. If so you might want to check out yargs as that is the option parser that I have come to prefer. However there are many other options of course, and as such this post is mainly just on nopt.

Read More

Hexo site sitemap automation with hexo-generator-sitemap

I have been looking for a good solution for automating the process of maintaining my sitemap with my hexo site. As I keep adding more content, and the site continues to grow, having a sitemap is going to just become yet even more important than it is to begin with. I have written a post on sitemaps before a few days ago, but I just cover what they are, and why they are important, and how to put one together manually. In this post I will write about the current solution I am using to automate the process of maintaining a sitemap called hexo-generator-sitemap.

Read More

Sitemaps

When authoring a blog, or any website for that matter there is the importance of getting indexed by the crawlers of major search engines. The crawlers of search engines will come around to your site every now and then, and index a page or two, before moving on to the next site. The crawler in most cases will not index the whole site each time, and it is easy to understand why, as they have a whole Internet to crawl.

Read More