JavaScript === (Triple Equals)

The triple equals sign in JavaScript means “equality without type coersion”. That means, the type and values must both be equal. Take for example the scenario where 0 is false. If we compare with 2 equal signs, the following statement is true. This is because the equality operator converts if they are not of the same type: 0 == false // true If we compare the same 0 and false … Continue reading JavaScript === (Triple Equals)

Debugging TypeScript with Google Chrome and Node

To debug TypeScript using Visual Studio Code, install the Debugger for Chrome, located at: https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome: You will see the message: The debugger will now be installed: Let’s say in our environment we have: A folder called TS with TypeScript files A TS file called HelloWorld.ts Like below: And we have an index.html page which calls the HelloWorld.ts file: Now, update your tsconfig.json file like below: And the launch.json file: Now, if … Continue reading Debugging TypeScript with Google Chrome and Node

Installing TypeScript for Visual Studio Code

Visual Studio Code has support for the TypeScript language. To use it, create a new file with TypeScript code in Visual Studio Code: And save the file, we will see TypeScript as an option: We can see Visual Studio Code has TypeScript Intellisense: Visual Studio Code does not include the TypeScript Compiler (tsc). To install it using the Visual Studio Code terminal, type: npm install -g typescript You will see … Continue reading Installing TypeScript for Visual Studio Code

Installing TypeScript on Node

To install TypeScript on Node, run the command: npm install -g typescript Now let’s create a new TypeScript file. First create a directory for our TypeScript project called TS, and create a new file HelloWorld.ts: Run the TypeScript compiler command: tsc HelloWorld.ts This will create a new js file: With JavaScript code:  

Introduction to TypeScript

TypeScript is a superset of JavaScript developed by Microsoft that supports classes, modules and interfaces, along with several other features. It is a static type language, meaning it will validate code at development time. JavaScipt is a dynamic language, which does not validate code at development time. Having a static type language is very useful for building robust code. To try out TypeScript online, go to www.typescriptlang.org and select Playground: You will … Continue reading Introduction to TypeScript

Installing a Node Web Server using http-server

Node has several web servers available for installation, including http-server: To install, type: npm install http-server -g To start the server, type: http-server This will start the web server at the addresses: Opening a web page at this address will display the contents of the current directory: If we create a folder called webserver with one file, index.html, and browse to this directory, we see the index file is displayed: … Continue reading Installing a Node Web Server using http-server