Swagger UI is a visual interface for viewing and interacting with RESTful APIs described using the OpenAPI Specification. To open a local JSON file in Swagger UI, we need to use a local HTTP server to serve the file and make it accessible to the Swagger UI interface. Any HTTP Server should work. In this…
JAVASCRIPT
The URLSearchParams interface defines utility methods to work with the query string of a URL.
const url = 'http://example.com?orderNumber=123456&pageSize=20';
const urlSearchParams = new URLSearchParams(url);
console.log(urlSearchParams.get('orderNumber')); //result: null
console.log(urlSearchParams.get('pageSize')); //result: 20
As shown in the above code snippet, it won't work as expected if you directly use the URL string in the URLSearchParams constructor. So the result of the first…
Many starter kits are available for creating React projects. Starter kits are useful, but most of them are black boxes. They improve productivity once the developers have an understanding of how they work. For large-scale applications, we want to create the application from scratch and want full control over it. This blog post aims to…
In JavaScript, an object can have two types of properties: data(standard) properties and accessor properties. Every property in an object has some attributes, this blog post we are going to take a look at the attributes of data properties. The data properties have the following four attributes: [[Configurable]] – Determines whether we can change the…
There are multiple ways to iterate/loop through all the properties in a JavaScript object.
Method 1: for-in loop
var person = {
name: 'Shravan Kasagoni',
age: 20,
isActive: true
};
person.constructor.prototype.printName = function() {
console.log(this.name);
};
person.constructor.prototype.encKey = 'somevalue';
person.constructor.prototype.printName = function() {
console.log(this.name);
};
The for-in loop iterates over all enumerable properties of an object.
for (var propertyName in person) {
console.log(propertyName, person[propertyName]);
}
Result:
name Shravan Kasagoni
age 20
isActive true
printName ƒ () {
console.log(this.name);
}
encKey somevalue
There are a lot of blog posts explaining this already, but most of them didn’t work for me. They miss one critical step, in this blog post I am going to provide instructions step by step how to use Node and NPM without installation or admin rights. I am going to provide the instructions for…
I recently started running my gulp tasks directly from Visual Studio Code instead of command line, I am going to explain how to do that. Step1: Make sure your project has Gulpfile.js or gulpfile.babel.js Step2: In Visual Studio Code once you open the project, press CMD + SHIFT + P (CTRL + SHIFT + P in Windows),…
Destructuring is a new feature in ECMAScript 2015. Destructuring allows binding a set of variables to a corresponding set of values (objects and arrays) anywhere we can bind a value to a single variable. Today we are already doing destructuring (extracting values) almost in every JavaScript program, but we do it manually. To understand destructuring…
I have been exploring and working on ECMAScript 2015 (formerly know as ECMAScript 6/ES6). I am going to blog about all the new ECMAScript 2015 features. Here is the list of blogposts: Destructuring in ECMAScript 2015 Spread Operator in ECMAScript 2015
I am developing lot of examples for Angular 2, find those examples on Github. Here are some important examples: ContactsManager GithubDashboard NotesApp VehiclesApp CustomValidator I will be updating these examples as Angular 2 progresses.