REPL stands for Read Eval Print Loop and it represents a computer environment like a Windows console or Unix/Linux shell where a command is entered and the system responds with an output in an interactive mode. Node.js or Node comes bundled with a REPL environment. It performs the following tasks − Read − Reads user’s input, parses the …
Step 1 – Import Required Module We use the require directive to load the http module and store the returned HTTP instance into an http variable as follows − var http = require("http"); Step 2 – Create Server We use the created http instance and call http.createServer() method to create a server instance and then we bind it at …
Node.js is a server-side platform built on Google Chrome’s JavaScript Engine (V8 Engine). Node.js was developed by Ryan Dahl in 2009 and its latest version is v0.10.36. The definition of Node.js as supplied by its official documentation is as follows − Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast and scalable network applications. Node.js …
Typescript History Let see important landmarks from the history of Typescript: After two years of internal development at Microsoft. TypeScript 0.9, released in 2013 Additional support for generics TypeScript 1.0 was released at Build 2014 In July 2014, a new TypeScript compiler came which is five times faster than it’s the previous version. In July …
Namespaces in Typescript Namespace is basically has collection of classes, interfaces, variables, functions together in one file. Namespace Syntax: namespace name{ export class { } export interface { } export const constname; } The code related in available under one namespace. Namespace working example: testnamespace.ts namespace StudentSetup { export interface StudDetails { name: string; age: …
What are the Modules in Typescript? The files created in typescript have global access, which means that variables declared in one file are easily accessed in another file. This global nature can cause code conflicts and can cause issues with execution at run-time. You have export and import module functionality which can be used to …
What is an Enum? An enum is an object which has a collection of related values stored together. Javascript does not support enums. Most of the programming language like java, c, c++ supports enum and it also available with typescript too. Enums are defined using keyword enum. How to declare an Enum? Syntax: enum NameofEnum …
What is the use of Arrow Function? Let’s take a look at the example to understand the use case of Arrow function: Example : var ScoreCard = function () { this.score = 0; this.getScore = function () { setTimeout(function () { console.log(this.score); // gives undefined. }, 1000); } } var a = new ScoreCard(); a.getScore(); …
Access Modifiers in Typescript Typescript supports public, private, and protected access modifiers to your methods and properties. By default, if access modifiers are not given the method or property is considered as public, and they will be easily accessible from the object of the class. In case of private access modifiers, they are not available …
What is an Array? An array is a data type in typescript wherein you can store multiple values. Let’s learn how to declare and assign values for an array. Since typescript is a strongly typed language, you have to tell what will be the data type of the values in an array. Otherwise, it will …