Categories
Javascript

Why self-closing script tags doesn’t work?

Self-closing script tag are not supported by all browsers as this may contain inline code and HTML is not smart enough to turn that feature on or off. Let’s see two types of script tag. One is self-closing script tag which browsers do not correctly recognize. <script src=”myscript.js” /> And the another is, <script src=”myscript.js”></script> […]

Categories
Javascript

Determine if variable is ‘undefined’ or ‘null’

In JavaScript, you can check whether a variable is undefined or null or blank or has a value defined in it. In JavaScript, ‘undefined’ means a variable has been declared but has not been assigned a value yet, such as: var a; console.log(a); //shows undefined console.log(typeof a); //shows undefined ‘null’ is an assignment value. This […]

Categories
Javascript

Getting Started with Handlebars JS

Handlebars js is a popular templating engine which is simple to use, powerful and has a large community based on the Mustache template language. Using this, you can write cleaner code and separate the generation of HTML from the rest of your JavaScript. Written in JavaScript language, Handlebars JS is a compiler which takes any […]

Categories
Javascript

Date Object – JavaScript

The Date object is a datatype that is used to work with dates and times which is built into the JavaScript language. Date objects are created with the new Date() that represents a single moment in time. Once a Date object is created, you can allow a number of methods to operate on it. This […]

Categories
Javascript

JavaScript Arrays

The JavaScript Arrays object is a global object that is used to store multiple values in a single variable. The JavaScript Arrays object is a global object that is used to store multiple values in a single variable i.e. collection of elements. Syntax: var cars = [ “Fiat”, “BMW”, “Nissan” ]; Note: Never put a […]

Categories
Javascript

Detect Browser in JavaScript

To detect browser in JavaScript, window.navigator object contains information about the user’s browser i.e. Firefox, Internet Explorer, Opera, etc. JavaScript has a standard object called navigator which contains data about user’s browser. It has a lot of properties. JavaScript window.navigator object can be written without window prefix. For example, navigator.appName navigator.appCodeName navigator.platform Browser detection is […]

Categories
Javascript

JavaScript Objects Overview

JavaScript is an Object Oriented Programming i.e. OOP language. It provides four basic capabilities i.e. Encapsulation, Aggregation, Inheritance and Polymorphism. For example as a car. It has properties like weight and color and and methods like start and stop. So, all cars have same properties, but the values differ from one car to another. Object […]

Categories
Javascript

JavaScript Browsers Handling

In this tutorial, you can get knowledge of JavaScript Browsers Handling or Compatibility and how to handle JavaScript in different browsers. Before applying JavaScript, we need to know the differences between different browsers and how they can be handled in different way. You can use built-in navigator object to get the information about the browser […]

Categories
Javascript

Enabling JavaScript in Browsers

Most of the modern browsers come with built-in JavaScript support and Enabling JavaScript makes you fully support in it. This tutorial contains the procedure of enabling and disabling JavaScript for supporting in your current browsers i.e. Internet Explorer, Firefox, Opera, chrome etc. Enable JavaScript in Firefox Follow this steps to enable/disable JavaScript in Firefox: Open […]

Categories
Javascript

JavaScript Strict mode

JavaScript Strict mode is a way to opt into a restricted variant which is an literal expression i.e. ignored by earlier versions of JavaScript. This is not just a subset but intentionally it has several semantics from normal code. Both strict mode and non-strict mode code can coexist, so incrementally, scripts can opt into strict […]