What are the differences between JavaScript Primitive Data Types and Objects?

Johar Ali
Published on 12-Jan-2018 06:25:31
Before beginning with the difference, let’s learn what are Primitive Datatypes. Primitive defines immutable values and introduced recently by ECMAScript standard.JavaScript allows you to work with three primitive data types, Numbers, eg. 3, 310.20 etc.Strings of text e.g. "This text string" etc.Boolean e.g. true or false.JavaScript also defines two trivial ... Read More

How does \B regular expression work in Python?

Rajendra Dharmkar
Published on 03-Jan-2018 12:43:59
The word boundary \b matches positions where one side is a word character (usually a letter, digit or underscore)\B matches all positions where \b doesn't match.The following code shows how regexpr \B worksimport re result = re.findall(r'\Bcat', 'certificate') result2 = re.findall(r'\Bcat', 'tomcat') result3 = re.findall(r'\Bcat', 'catfish') print result, result2, result3This ... Read More

What are JavaScript data types and data structures?

Amit Sharma
Published on 12-Jan-2018 06:11:40
DatatypesOne of the most fundamental characteristics of a programming language is the set of data types it supports. These are the type of values that can be represented and manipulated in a programming language.JavaScript is a dynamic language and has some built-in data structures. Datatypes hold different values. There are ... Read More

What are primitive data types in JavaScript?

Published on 12-Jan-2018 06:05:55
Datatypes hold different values. There are two types of datatypes in JavaScript: Primitive and Non-Primitive. Primitive defines immutable values and was introduced recently by ECMAScript standard.Primitive datatypes include the following:String As the name suggests, the string is for a sequence of characters, for example, “demo”, “Hi”, etc. Boolean It has two values i.e ... Read More

How does JavaScript Variable Scope work?

Published on 12-Jan-2018 05:15:22
The scope of a variable is the region of your program in which it is defined. JavaScript variables have only two scopes.Global Variables − A global variable has a global scope which means it can be defined anywhere in your JavaScript code.Local Variables − A local variable will be visible ... Read More

How to write inline JavaScript code in HTML page?

Rahul Sharma
Published on 11-Jan-2018 12:26:28
Inline JavaScript Code − If you are adding some JavaScript code in an HTML file without using the src tag then it is known as inline JavaScript code. That’s all you need to know.

What are the differences between inline JavaScript and External file?

Johar Ali
Published on 11-Jan-2018 09:36:14
The following are the difference between inline JavaScript and external file −External scriptsThe browser stores the external script once it is downloaded for the first time. If it is to be referenced again, then no additional download is needed.This reduces download time and size.The async and defer attributes have an ... Read More

Is it better to have one big JavaScript file or multiple light files?

Amit Sharma
Published on 11-Jan-2018 08:42:02
To avoid multiple server requests, group your JavaScript files into one. Whatever you use for performance, try to minify JavaScript to improve the load time of the web page.If you are using single page application, then group all the scripts in a single file.If you are using multiple files, then ... Read More

How page load time affects with JavaScript?

Published on 11-Jan-2018 08:16:34
Page load time gets affected with JavaScript files and code. If you are not optimizing JavaScript files then the page load time will increase, which shouldn’t happen. Minify the JavaScript code to decrease the page load time.Also, cache JavaScript file for better results. For better performance, use inline and external ... Read More

How to use the same JavaScript in multiple content pages?

Rahul Sharma
Published on 11-Jan-2018 08:14:38
To use the same JavaScript in more than one page, add the js code in an external JavaScript file. Let’s say the following demo.js is our external JavaScript file −function display() {    alert("Hello World!"); }Now add the external JavaScript file to the following HTML web page. In the same ... Read More