Category: javascript

  • Classes in Javascript vs Java

    Nothing happens outside a class in Java. To create an object you need a class. Even to print a simple “Hello World” you need a class. That is not always the case with Javascript. You can create objects without using a class. Everything need not be encapsulated within a class! There are similarities between the…

  • Variables – Java vs Javascript

    Variables are critical to any programming language. It is where you store temporary data. Not all data needs to be stored in the database, whatever doesn’t need to be stored in the database and is needed temporarily during your program execution are stored in variables. Variables in Javascript differ from variables in Java in quite…

  • Java vs Javascript – Say Hello World!

    One of the complaints about Java programming language is that it is verbose. Imagine you are new to programming. And you want to learn to program. The first thing most of us traditionally do is to print “Hello World!” . And to do this in Java you need to go through a lot of ordeal:…

  • try catch block in Java vs Javascript

    In both Java and JavaScript, the try-catch block is used to handle exceptions that may occur in the code. The basic structure of a try-catch block in both languages is similar: a block of code is put in a “try” block, and any exceptions that are thrown in that block are caught and handled in…

  • What are the differences between HTTPS Node js module and Axios library for making REST API calls

    What are the differences between HTTPS Node js module and Axios library for making REST API calls

    If you are developing a node js project you may need to call third party REST APIs or internal REST APIs from your application. There are many options available to make these calls. Node JS provides its own https module for the same. And we have the more elegant Axios library which you need to…

  • How to consume a data stream in javascript?

    Dealing with huge amount of continuous data (data streams) is a challenge for enterprise applications. Fortunately , reactive programming provides a standard solution to this problem. You can generate and consume data streams without blocking the user and without overwhelming the server or client. This post explains how to do reactive programming on the server…

  • What is a closure in Javascript?

    Let’s say you declare a variable in javascript. What is the scope of this variable? It is the entire function in which it is declared. What if it is declared within a particular block ? Still it’s scope is the entire function in which it is declared. For example: In the above code even though…

  • How do javascript functions differ from Java functions?

    How do you avoid repeated coding in a programming language? By using functions. You write the piece of code with the logic you want to execute inside a function and then call it wherever you want. Javascript functions achieve the same but differ a bit from languages like Java. Here are the features in javascript…

  • How the binary logical operators ‘&&’ and ‘||’ differ in Javascript from Java

    The binary logical operators && and || are used to determine whether an expression is true or false. && means the expression on both the side of the operator should be true. Example: Even if one of the expressions is false the final expression evaluates to false || means any of the two expressions should…

  • undefined vs null in javascript

    If you are from the background of a programming language like Java , you might feel that the way to represent a “no value” is through the value “null”. But Javascript has two ways to denote a “no value”. One is “undefined” Another is “null” “undefined” represents “no value” whereas “null” represents “no object” to…