Manisha Patil

Manisha Patil

32 Articles Published

Articles by Manisha Patil

Page 3 of 4

What is the drawback of creating true private methods in JavaScript?

Manisha Patil
Manisha Patil
Updated on 24-Aug-2022 450 Views

Using private methods has a simple underlying concept. In this situation, you can declare private methods or private properties, which are used to hide a class's internal functionality from those other classes, whenever you wish to keep something private, whether it be a method or a property. You can include private fields, static methods, instance methods, and getters and setters that are only accessible to you. Truly private fields and methods are delivered through private class features, with the language maintaining that privacy rather than a custom. Benefits include preventing naming conflicts between class features and the other of the ...

Read More

Tag names of body element's children in JavaScript?

Manisha Patil
Manisha Patil
Updated on 24-Aug-2022 485 Views

A property of an element called "children" delivers all child elements of the element as objects. We will learn how to use Javascript to obtain the child element of the parent in this tutorial. The challenge is to use JavaScript to choose a certain element in an HTML document and retrieve all of the parent element's children. There are 2 methods for doing this to obtain the child element − making use of the children property making use of the querySelector Method Through the use of examples, we will discuss both strategies and understand how they are applied. ...

Read More

Is JavaScript a pass-by-reference or pass-by-value language?

Manisha Patil
Manisha Patil
Updated on 23-Aug-2022 589 Views

JavaScript provides us with functions, that are a collection of pre-defined instructions or statements that are only carried out when we call the function that contains this code. The function accepts one or more arguments as input and output. You can pass values or references for the input arguments. All function parameters are always given by value in JavaScript. It indicates that JavaScript inserts copies of variable values into function parameters. The passing variables outside of the function are not affected by any modifications you make to the function's internal arguments. Or, to put it another way, changes made to ...

Read More

How to generate a random number in JavaScript?

Manisha Patil
Manisha Patil
Updated on 23-Aug-2022 2K+ Views

The Math object, a built-in object with attributes or methods for carrying out mathematical operations, has the native implementation of the random() method in JavaScript. As its name suggests, the random() method aids in the generation of random numbers. The return value of the Math.random() method is a floating-point, sort of semi number between 0 (inclusive) and 1. (exclusive). This is defined mathematically by the equation 0 = x 1. The Math.random() function will return a floating-point, pseudo-random number in the range 0 to less than 1 (inclusive of 0 but not 1) with an essentially uniform distribution throughout that ...

Read More

Passing unknown number of arguments to a function in Javascript

Manisha Patil
Manisha Patil
Updated on 23-Aug-2022 3K+ Views

The terms "parameters" and "arguments of a function" are frequently used synonymously in JavaScript, despite the fact that there is a substantial distinction between the two. The function parameters are included when we define a function. While defining a function, you may also specify a list of variables; these variables are referred to as function parameters. On the other hand, "function parameters" are the values we pass when we call or execute the newly created function. In JavaScript, the variables listed in the function declaration serve as the argument values. The arguments that are part of the function definition are ...

Read More

"extends" keyword in JavaScript?

Manisha Patil
Manisha Patil
Updated on 23-Aug-2022 1K+ Views

In JavaScript, you may extend both classes and objects with the extends keyword. It is frequently used to build classes that are children of other classes. In addition to built-in objects, customized classes can also be subclass using the extends keyword. The classes serve as the blueprint for a real-world item so that we may easily change, access, and utilise them in programming. It is specified to establish an abstract data type to hold a specific sort of information together with the methods for manipulating that information. You use the extends keyword to use class inheritance. Any constructor with the ...

Read More

Create many JavaScript objects as the same type?

Manisha Patil
Manisha Patil
Updated on 23-Aug-2022 2K+ Views

JavaScript is a lenient object-oriented language. We'll look at various JavaScript object creation methods in this article. It is crucial to know that JavaScript is an object-oriented language based on prototypes instead of classes before moving on. It can be more difficult to understand how JavaScript enables you to build hierarchies of objects and to get an inheritance of properties and their values because of this different foundation. Programming objects can combine variables, functions, and data structures. In other words, objects can hold values, you can use objects to manipulate values, and you can combine values into more complicated objects, ...

Read More

What is the importance of '/i' flag in JavaScript?

Manisha Patil
Manisha Patil
Updated on 04-Aug-2022 519 Views

Let us understand first about regular expressions before jump into I flag. A string of characters that creates a search pattern is called a regular expression. The search pattern can be applied to text replacement and search operations. A regular expression might be a simple pattern with one letter or a more complex one. Text search and replace operations of every kind can be carried out using regular expressions. The literal notation and the constructor are the two methods for creating a RegExp object. The literal notation consists of a pattern among both two slashes and optionally flags beyond ...

Read More

What is the importance of '/g' flag in JavaScript?

Manisha Patil
Manisha Patil
Updated on 04-Aug-2022 645 Views

Let us understand first about regular expressions before jumping into the /g flag. A string of characters that creates a search pattern is called a regular expression. The search pattern can be applied to text replacement and search operations. A regular expression might be a simple pattern with one letter or a more complex one. Text search and replace operations of every kind can be carried out using regular expressions. The literal notation and the constructor are the two methods for creating a RegExp object. The literal notation consists of a pattern among both two slashes and optionally flags ...

Read More

How to get the protocol and page path of the current web page in JavaScript?

Manisha Patil
Manisha Patil
Updated on 04-Aug-2022 760 Views

Protocol The URL segment that specifies the data transfer protocol to be utilised is referred to as the protocol of a URL. In this example, https:// indicates for the HTTPS protocol. We will learn how to obtain the website URL for the currently seen webpage or website in this article. The 'URL' property of the Document object, which has data on the current URL, is used to get the current URL. The "URL" property returns a string that includes the complete address of the currently seen page as well as the HTTP protocol, such as (http://). Syntax Following is the ...

Read More
Showing 21–30 of 32 articles
Advertisements