Vineeth.mariserla has Published 117 Articles

How to access nested json objects in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 29-Jun-2020 11:42:50

13K+ Views

Accessing nested json objects is just like accessing nested arrays. Nested objects are the objects that are inside an another object.In the following example 'vehicles' is a object which is inside a main object called 'person'. Using dot notation the nested objects' property(car) is accessed.Example-1Live Demo    var person ... Read More

What is the use of Object.isFrozen() method in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 29-Jun-2020 11:36:06

107 Views

Object.isFrozen()Object.isFrozen() method is used to find whether an object is frozen or not. An object is frozen if it followed the below criteriaIt should not be extensible.Its properties should be non-configurable.It shouldn't accept any new properties.SyntaxObject.isFrozen(obj);Parameters - Object.isFrozen() accepts an object as a parameter and scrutinizes whether it is frozen or not and ... Read More

How many ways can a property of a JavaScript object be accessed?

vineeth.mariserla

vineeth.mariserla

Updated on 29-Jun-2020 11:33:58

270 Views

 An object property can be accessed in two ways. One is .property and the other is [property].Syntax-1Object.property;Syntax-2Object["property"];For better understanding, lets' look at the following example.In the following example an object called 'person' is defined and its properties were accessed in a dot notation.ExampleLive Demo var person = { ... Read More

How to check whether an array is a true array in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 29-Jun-2020 11:28:55

113 Views

In javascript, arrays are not true arrays. They are javascript objects. So when we try to know their type using typeof() operator the displayed output will be object.Syntaxtypeof(operand);parameters - typeof() operator takes an operand and returns the data type of the operand. In the following example even though variable 'a' is an ... Read More

How to add two strings with a space in first string in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 29-Jun-2020 11:10:23

5K+ Views

To add two strings we need a '+' operator to create some space between the strings, but when the first string itself has a space with in it, there is no need to assign space explicitly. In the following example since the string 'str1' has a space with in it, just ... Read More

What is the use of weakSet.has() method in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 29-Jun-2020 09:49:47

87 Views

weakSet.has()This is an inbuilt function in javascript which is used to return a boolean value on scrutinizing whether an object is present in weakSet or not. The weakSet object lets you store weakly held objects in a collection.SyntaxweakSet.has(obj);ArgumentsFrom the above line of code,  weakSet.has() accepts a parameter 'obj' and checks whether the ... Read More

How to add a number and a string in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 29-Jun-2020 09:44:54

8K+ Views

In javascript , we can add a number and a number but if we try to add a number and a string then, as addition is not possible, 'concatenation' takes place.In the following example, variables a, b, c and d are taken. For variable 'a', two numbers(5, 5) are added therefore it ... Read More

How to count a number of words in given string in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 29-Jun-2020 09:34:01

4K+ Views

Using regular expressions it is easy to count number of words in a given string in javascript. There are some steps to be followed to count number of wordsSteps to followWe know that a sentence or a phrase is made up of words that are separated with spaces in between ... Read More

How to change css styles of elements in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 29-Jun-2020 09:28:20

3K+ Views

JavaScript can change Css styles such as color, font size etc. of elements using some methods such as getElementById(), getElementByClassName() etc.In the following example font style and font size of the elements have changed using getElementById() method.Example-1Live DemoIn the following example, using style commands "style.fontSize" and "style.fontStyle", the provided texts are changed ... Read More

What is global namespace pollution in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 29-Jun-2020 08:55:29

945 Views

Global namespace pollutionPolluting Global namespace causes name collision. This name collision is very common in large projects where we may be using several javascript libraries. Let's discuss in detail what a name collision is.let's take a scenario in which 2 teams named A1 and A2 are working on a project. They ... Read More

Advertisements