JavaScript definite guide – Arrays

An array is an ordered collection of values. Each value is called an element, and each element has a numeric position in the array, known as its index. JavaScript arrays are untyped: an array element may be of any type, and different elements of the same array may be of different types. Array elements may … Continue reading JavaScript definite guide – Arrays

Functional Programming in JavaScript — Higher Order JavaScript

Higher Order JavaScript This chapter covers Why JavaScript is a suitable functional language JavaScript as a language that enables multi paradigm development Immutability and policies for change Understanding higher-order and first-class functions Exploring the concepts of closures and scopes Practical sue of closures As applications get bigger, so does their complexity. No matter how good … Continue reading Functional Programming in JavaScript — Higher Order JavaScript

Functional Programming in JavaScript — Becoming functional

What is functional programming? In simple terms, functional programming is a software development style that places a major emphasis on the use of functions. What better text to print than the good ol “Hello World”: 1document.querySelector(‘#msg’).innerHTML = ‘<h1>Hello world</h1>’ This program is simple, but because everything is hardcoded, you can’t use it to display messages … Continue reading Functional Programming in JavaScript — Becoming functional

JavaScript definite guide – Objects

JavaScript's fundamental datatype is the object. An object is a composite value: it aggregates multiple values (primitive values or other objects) and allows you to store and retrieve those values by name. An object is an unordered collection of properties, each of which has a name and a value. Any value in JavaScript that is … Continue reading JavaScript definite guide – Objects

JavaScript definite guide – Functions

In JavaScript, functions are objects, and they can be manipulated by programs. Javascript can assign functions to variables and pass them to other functions, for example. Since functions are objects, you can set properties on them, and even invoke methods on them. JavaScript function definitions can be nested within other functions, and they have access … Continue reading JavaScript definite guide – Functions

Learn JavaScript Next – New Array Methods

5.6 Summary 1Array.from creates an array containing all the values from an array-like object 1Array.of creates an array with supplied values is safer than 1new Array 1Array.prototype.includes checks if array contains a value at any of it’s indices 1Array.prototype.find searches an array based on a criteria function and returns a first value found 1Array.prototype.fill fills … Continue reading Learn JavaScript Next – New Array Methods

[book note] Manning MEAP: JavaScript Next – Unit 1: Variables & Strings

Unit 1: Variables and & Strings Lesson 1. Declaring Variables with 1let In the history of JavaScript, variables have always been declared using the keyword var. ES6 introduces two new ways to declare variables, with the let and const keywords. Both of these work slightly different than variables with var. There are two primary differences … Continue reading [book note] Manning MEAP: JavaScript Next – Unit 1: Variables & Strings

[book note] Manning MEAP: JavaScript Next – Unit 2: Objects & Arrays

Unit 2 Objects & Arrays Lesson 5: New Array Methods Arrays are probably the most common data structure used in JavaScript. We use them to hold all kinds of data but sometimes getting the data we want into or out of the array isn’t as easy as it should be. However those tasks just got … Continue reading [book note] Manning MEAP: JavaScript Next – Unit 2: Objects & Arrays

[book note] Manning MEAP – Election in Action – Chapter 6

Building Application and Context Menus This chapter covers: Creating menus using Electron’s Menu and MenuItem modules Building menus from a template Defining custom menus for different target operating systems. Assigning common operating system roles to our menu items Making menu items with custom, application-specific functionality Creating custom context menus for different parts of your user … Continue reading [book note] Manning MEAP – Election in Action – Chapter 6

Node.js in Action

Building a RESTful web service [code lang=”javascript”] // Listing 4.1 RESTful routes example const express = require(‘express’) const app = express() const articles = [{ title: ‘Example’ }] app.get(‘/articles’, (req, res, next) => { res.send(articles) }) app.post(‘/articles’, (req, res, next) => { res.send(‘OK’) }) app.get(‘/articles:id’, (req, res, next) => { const id = req.params.id console.log(‘Fetching:’, … Continue reading Node.js in Action