TypeScript – Namespaces
A namespaces is a way to logically group related code. This is inbuilt into TypeScript unlike in JavaScript where variables declarations go into a global scope and if multiple JavaScript…
A namespaces is a way to logically group related code. This is inbuilt into TypeScript unlike in JavaScript where variables declarations go into a global scope and if multiple JavaScript…
An object is an instance that contains a set of key-value pairs. The values can be scalar values or functions or even array of other objects. The syntax is given below −…
TypeScript is object-oriented JavaScript. TypeScript supports object-oriented programming features like classes, interfaces, etc. A class in terms of OOP is a blueprint for creating objects. A class encapsulates data for…
An interfaces is a syntactical contract that an entity should conform to. In other words, an interface defines the syntax that any entity must adhere to. Interfaces define properties, methods,…
TypeScript 1.4 gives programs the ability to combine one or two types. The Unions types are a powerful way to express a value that can be one of the several…
At times, there might be a need to store a collection of values of varied types. Arrays will not serve this purpose. TypeScript gives us a data type called tuples…
In this topic, we will discuss returning an array function in Typescript Allows a function to return an array. Example function disp():string[] { return new Array("zafrul","subrat","Jay","ajit") } var nums:string[] =…
You can pass to the function a pointer to an array by specifying the array's name without an index. Example var names:string[] = new Array("zafrul","subrat","Jay","ajit") function disp(arr_names:string[]) { for(var i…
An array element can reference another array for its value. Such arrays are called multidimensional arrays. TypeScript supports the concept of multi-dimensional arrays. The simplest form of a multi-dimensional array…
unshift() method adds one or more elements to the beginning of an array and returns the new length of the array. Syntax array.unshift( element1, ..., elementN ); Parameter Details element1,…