Skip to main content

Posts

Showing posts with the label Basic JavaScript

Callbacks,Promises,Async Await and Closure in JavaScript.

This weeks blog will be including about callbacks and issues of it,promises which was used to overcome the issues of callbacks and closure in JavaScript. Callbacks, promises and async await All theses ways are used to deal with asynchronous data. By default, JavaScript programs run using a single thread. Though there are ways to create new threads, JavaScript is considered as single threaded language. JavaScript does not wait for I/O operations to get completed, instead it continues the execution of the program. This is called as non-blocking I/O. So that JavaScript is an asynchronous programming language because of this NIO nature. Callbacks, Promises and Async Await. As an example when a request is made to a server it will take couple of seconds to response with the relevant data, therefore you do not want to stall your program till the data is returned. You must keep on going or doing something where callbacks come in. Extra facts. until es6 => callbacks were used es...

Classes and Objects in JavaScript.

The ways classes are created, how to manage class structure,inheritance hierarchy in java script will be covered in this blog. OOP concepts can be applied in java Script but it is a bit different than Java. Classes and Objects. How to create a class in JavaScript. Functions in JavaScript act as objects. We use functions to create classes. These functions are known as constructor functions. Difference between a normal function and a constructor function(conventions created by programmers) is that normal functions are written using camel notation and the first letter of the constructor functions(classes) starts with an uppercase letter and defined as a noun. Creating objects and classes. When creating an object; Objects are clone in JavaScript because class is an object unlike in Java. Creating JASON like objects using curly brackets.  Creation of JSON object. Console output. JSON objects not only have properties and methods it also may include embedde...