Front End Technology Articles

Page 224 of 652

How to calculate the nth root of a number in JavaScript?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 06-Jan-2023 1K+ Views

We have given a number and the task is to calculate the nth root of that number using JavaScript. We have multiple ways to achieve this, some of which are the following. Using Math.pow() Method Using Logarithm To get the nth root of a number firstly let’s understand whose root we can calculate and which number’s root we cannot calculate. If the number is positive and the root is also even then we will get two solutions. E.g − 2nd root of 16 is +4 and -4, similarly 4th root of 16 is +2 and -2 If ...

Read More

How to attach one or more drop-shadows to the box with JavaScript?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 06-Jan-2023 2K+ Views

To attach one or more drop shadows to a box with JavaScript, you can use the box-shadow style property. You can specify the shadow's offset, blur radius, spread radius, and color by passing values for these properties in the box-shadow property. Syntax Following is the syntax to add one or more drop shadows to the box with JavaScript − box.style.boxShadow = "offset-x offset-y blur-radius spread-radius color"; Here the box.style.boxShadow property in JavaScript allows you to add one or more drop shadows to a box element. It takes the following parameters offset-x − This is the horizontal offset of ...

Read More

How to access cookies using document object in JavaScript?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 06-Jan-2023 8K+ Views

With JavaScript, you can easily access/ read cookies with the “document.cookie” property. Reading a cookie is just as simple as writing one because of the value of the document.cookie object is the cookie. The document.cookie string will keep a list of name=value pairs separated by semicolons, where the name is the name of a cookie and value is its string value. In this article, we will learn how to access cookies using document object in JavaScript. Syntax document.cookie Return value − All the cookies are saved in the browser in a single string. The document.cookie string will keep ...

Read More

What is Unary Negation Operator (-) in JavaScript?

Abhishek
Abhishek
Updated on 06-Jan-2023 529 Views

The Unary Negation Operator first converts the operand into a number, and after that it negates. It operates on a single operand. It returns the negation of the operand. A boolean operand is converted to 0 or 1, and then negation is done. Similarly, a number with a base other than decimal is first converted to base 10, then the negation is computed. Syntax The following syntax will show you how you can use the unary negation operator to negate the value of a number − -x Here unary operator (-) negates x. Let us understand the application of ...

Read More

What is Subtraction Operator (-) in JavaScript?

Abhishek
Abhishek
Updated on 06-Jan-2023 2K+ Views

The subtraction operator is also known as the minus operator. It is a binary operator that means it requires at least two operands to operate on. It will not work with a single operand. Generally, the subtraction operator subtracts or minus the value of the second operand from the first operand and returns the result as it is, that means if the result of two numbers subtraction is negative it will return the negative result, else it will return positive result if that’s positive. In this article, we are going to discuss about the subtraction operator in details and its ...

Read More

Difference between Procedural and Declarative Knowledge

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 05-Jan-2023 23K+ Views

We can express the knowledge in various forms to the inference engine in the computer system to solve the problems. There are two important representations of knowledge namely, procedural knowledge and declarative knowledge. The basic difference between procedural and declarative knowledge is that procedural knowledge gives the control information along with the knowledge, whereas declarative knowledge just provides the knowledge but not the control information to implement the knowledge. Read through this article to find out more about procedural knowledge and declarative knowledge and how they are different from each other. What is Procedural Knowledge? Procedural or imperative knowledge clarifies ...

Read More

What is a standard for commenting a function in JavaScript?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 05-Jan-2023 8K+ Views

JavaScript is used everywhere, from creating the back end using environments like Node.js to creating the front end using React.js, Vue.js, etc. In JavaScript, the uses of a function are very high, it is used for performing a group operation, it is used as a callback, as a constructor, and in many more places. With the high use of functions in JavaScript, the code becomes full of functions everywhere and looks messy and hard to debug. At a point, it is difficult to find which functions trigger which event and which callbacks are used for what, so it is ...

Read More

Explain the different ready states of a request in AJAX

Shubham Vora
Shubham Vora
Updated on 05-Jan-2023 3K+ Views

AJAX stands for Asynchronous JavaScript and XML. It is a set of web development techniques to create interactive web applications. AJAX allows a web page to communicate with a server without reloading the page. Ready states are an important part of working with AJAX requests. The ready state of a request indicates the request’s status to the server and allows the client to track the progress of the request. In the below, we detailed the different ready states of AJAX. UNSENT STATE (0) This is the first ready state of the AJAX. It is denoted by the integer 0. When ...

Read More

Explain the working of timers in JavaScript

Shubham Vora
Shubham Vora
Updated on 05-Jan-2023 720 Views

In JavaScript, timers are a very noteworthy feature. As like the normal watch timer, we can start the timer at a time and execute the function or code in JavaScript after a particular time. In simple terms, we can use the timer to execute the code after some delay. For example, when you visit some website, it shows the signup box after 3 to 4 minutes of your visit, and that we can achieve using JavaScript. We can set the delay timer to show the signup popup box. Another good example of the timer in real life is ads ...

Read More

Explain the differences in the usage of foo between function foo() {} and var foo = function() {}

Shubham Vora
Shubham Vora
Updated on 05-Jan-2023 1K+ Views

In JavaScript, we have different ways to define the functions. The function foo() {} and var foo = function() { } is two different ways to define the function. Both ways have their benefits and different use cases; however, both give the same result when executing the function. So, this tutorial will teach us the difference between both ways to define a function. Explanation of the function foo() { }: function declaration The function foo() { } is the normal way to declare the function in JavaScript, which every beginner and developer uses. Also, we can call it a named ...

Read More
Showing 2231–2240 of 6,517 articles
« Prev 1 222 223 224 225 226 652 Next »
Advertisements