vineeth.mariserla

vineeth.mariserla

72 Articles Published

Articles by vineeth.mariserla

Page 2 of 8

what is the main difference between '=' and '==' operators in javascript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 314 Views

In JavaScript, the = operator is used for assignment, while the == operator is used for equality comparison. Understanding this difference is fundamental to writing correct JavaScript code. The Assignment Operator (=) The = operator assigns a value from the right side to the variable on the left side. It does not compare values. var x = 5; // Assigns 5 to variable x var y = "6"; // Assigns string "6" to variable y var z = x; ...

Read More

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

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 436 Views

JavaScript object properties can be accessed in two main ways: dot notation and bracket notation. Each method has its own use cases and advantages. Dot Notation The dot notation is the most common and readable way to access object properties when the property name is known at compile time. object.propertyName Bracket Notation The bracket notation uses square brackets with the property name as a string. This method is more flexible and allows dynamic property access. object["propertyName"] object[variableName] Example: Using Dot Notation var person = ...

Read More

Using a JavaScript object inside a static() method?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 136 Views

In JavaScript, static methods belong to the class itself, not to instances. You cannot directly access instance objects or use this inside static methods. However, you can pass objects as parameters to static methods to access their properties. Problem: Direct Object Access in Static Methods In the following example, trying to call a static method on an instance will result in an error because static methods should be called on the class, not the instance. class Company { constructor(branch) { ...

Read More

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

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 245 Views

In JavaScript, arrays are actually objects, which makes type checking tricky. When you use the typeof operator on an array, it returns "object" rather than "array", making it unreliable for array detection. The Problem with typeof The typeof operator cannot distinguish between arrays and plain objects since both return "object". Syntax typeof operand Parameters: The typeof operator takes an operand and returns a string indicating the data type of the operand. Example: typeof with Arrays and Objects var a = [1, 2, 5, ...

Read More

Explain about logical not(!) operator in detail with example in javascript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 218 Views

The logical NOT operator (!) is a unary operator that inverts boolean values. It returns true for falsy values and false for truthy values. Syntax !expression How It Works The NOT operator first converts the operand to a boolean value, then returns its opposite: If the operand is truthy, it returns false If the operand is falsy, it returns true Example with Boolean Values document.getElementById("boolean-demo").innerHTML = "!true = " + !true ...

Read More

How to get the application name and version information of a browser in JavaScript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 2K+ Views

JavaScript provides a navigator object that contains information about the browser. To get the application name and version information, the navigator object provides navigator.appName and navigator.appVersion properties respectively. Application Name of the Browser The navigator.appName property returns the application name of the browser. However, due to historical reasons, most modern browsers (Chrome, Firefox, Safari, Edge) return "Netscape" regardless of their actual name. Example document.write("Application Name: " + navigator.appName); Output Application Name: Netscape Browser Version Information The navigator.appVersion property provides ...

Read More

What is the importance of _isEqual() method in JavaScript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 1K+ Views

The _.isEqual() method from Underscore.js and Lodash libraries provides deep equality comparison for JavaScript objects. Unlike native JavaScript comparison operators, it performs value-based comparison rather than reference-based comparison. Why _.isEqual() is Important JavaScript's native equality operators (== and ===) only check if two objects are the same reference in memory, not if they have the same content. The _.isEqual() method solves this by performing deep comparison of object properties, regardless of property order. Syntax _.isEqual(object1, object2); It accepts two values as parameters and returns true if they are equivalent, false otherwise. Example: ...

Read More

How to access nested json objects in JavaScript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 15K+ Views

Accessing nested JSON objects in JavaScript involves navigating through multiple levels of object properties. Nested objects are objects contained within other objects, creating a hierarchical data structure. What are Nested JSON Objects? A nested JSON object has one or more objects as property values. This creates multiple layers that you need to traverse to access specific data. Using Dot Notation The most common way to access nested properties is using dot notation, where you chain property names with dots. Example 1: Single Level Nesting var person = ...

Read More

Write a number array and add only odd numbers?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 1K+ Views

In JavaScript, you can sum only the odd numbers from an array by using the modulus operator (%) to check if a number is odd, then adding it to a running total. How It Works The modulus operator returns the remainder when a number is divided by 2. If the remainder is not equal to 0, the number is odd. Example: Summing Odd Numbers var tot = 0; var a = [1, 45, 78, 9, 78, 40, 67, 76]; ...

Read More

How to modify properties of a nested object in JavaScript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 3K+ Views

There are two methods to modify properties of nested objects in JavaScript. One is Dot notation and the other is Bracket notation. The functionality is the same for both methods, but they differ in their syntax and use cases. Let's discuss them in detail with practical examples. Dot Notation Method Dot notation is the most common way to access and modify nested object properties. Use this when property names are valid identifiers and known at compile time. Example In the following example, initially the value of property country is England. Using dot notation, the value ...

Read More
Showing 11–20 of 72 articles
« Prev 1 2 3 4 5 8 Next »
Advertisements