Let’s say we have an array of numbers in JavaScript that looks like this: let array = [1, 2, 3, 5, 2, 8, 9, 2]; and we want to count the number of 2’s in the array. A quick and direct way to get the count of 2’s would be to do something like this: … Continue reading JavaScript: How to find the count of an element in an array using filter( )
JavaScript
JavaScript: How to create a formatted date time string
In JavaScript, to get today’s date and time, all we need to do is use a call to Date() For example: let today = new Date(); This gives us today’s date and the current time, in the form of a Date object that looks like this: ‘Date’ is the key (left), and the value is … Continue reading JavaScript: How to create a formatted date time string
jQuery: How to use jQuery in a project and confirm it is working
The fastest way to make jQuery available for a project is to use a CDN in the HEAD portion of the HTML. For example, here is a CDN for jQuery 3.3.1: <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js”></script> With this in place, you can confirm that jQuery is available and working by adding this block of JavaScript code to the … Continue reading jQuery: How to use jQuery in a project and confirm it is working
Spacebars: How to handle an empty data container when iterating with #each
In a Meteor project, when using Blaze (Spacebars) to set up iteration through a data container in an HTML template, the normal pattern is to use an ‘each’ block. For example: {{ #each dataContainer }} … HTML tags here … … HTML tags here … {{ /each }} An each block starts with #each and … Continue reading Spacebars: How to handle an empty data container when iterating with #each
Node.js: How to install Node + npm and confirm the installation in less than 5 minutes
To install node.js, start at the nodejs.org website: https://nodejs.org/en/ Then click the green box to download the .msi. This will download the “node-v9.8.0-x64.msi” to your downloads folder. Then click the .msi to install node. I chose to change the path to C:\nodejs . Then once the installation is complete, restart your computer. Once the computer … Continue reading Node.js: How to install Node + npm and confirm the installation in less than 5 minutes
JavaScript: How to use the array.map( ) method
The JavaScript map()method creates a new array with the results of calling a provided function on every element in this array. For example, lets say you have a small array of numbers called “numbers”: var numbers = [1, 4, 9]; We can use .map on this array to find the square root of each of … Continue reading JavaScript: How to use the array.map( ) method
Meteor: How to install Meteor and get a project started in less than 5 minutes
In this article, I want to detail how to install Meteor and get a project quickly up and running. Step 1: Install Meteor In order to install Meteor, the first step according to the installation instructions is to install a tool called “chocolatey”. https://chocolatey.org/install This can be installed with a cmd.exe command. Once that … Continue reading Meteor: How to install Meteor and get a project started in less than 5 minutes
React: How to use CSS in React
In this article I will describe two ways to use CSS in React. Option 1: Inline Define CSS styles ‘inline’ inside React. This uses the props key ‘style’, which uses a dictionary to define all of the CSS attributes. However, these CSS attributes have differences from normal CSS. For example, 1. The attribute names must … Continue reading React: How to use CSS in React
React: How to create the simplest app using Atom
This article is a continuation of the previous article where I created the simplest possible React app in Codepen: React.js: How to create the simplest app using Codepen A second way to create React apps is to use a text editor such as Atom, and reference the necessary resources via CDNs (content delivery networks). In … Continue reading React: How to create the simplest app using Atom
React: How to create the simplest app using Codepen
One easy way to create React apps is to use Codepen. Using Codepen to practice creating React apps requires you to first set some JS settings. The JavaScript Preprocessor should be set to Babel because we will be using JSX instead of pure JavaScript. The Quick-add select menu can be used to select both the … Continue reading React: How to create the simplest app using Codepen