Front End Technology Articles - Page 573 of 860

HTML DOM paddingLeft Property

Sharon Christine
Updated on 30-Jul-2019 22:30:26

146 Views

The HTML DOM paddingLeft property returns and add left padding to an HTML element.SyntaxFollowing is the syntax −1. Returning left paddingobject.style.paddingLeft2. Adding left paddingobject.style.paddingLeft=”value”ValuesHere, “value” can be the following −ValueDetailslengthIt defines value padding in length unit.initialIt defines padding to its default value.inheritIn this padding gets inherited from its parent element.percentage(%)It defines padding in percentage of the width of parent element.ExampleLet us see an example of paddingLeft property − Live Demo HTML DOM paddingLeft property    .outer-box{       background-color:#db133a;       width:300px;       height:300px;       margin:1rem auto;    }   ... Read More

How to check whether a NaN is a NaN or not in JavaScript?

Manisha Patil
Updated on 04-Aug-2022 11:50:13

425 Views

In this article let us understand how to check whether a NaN is a NaN or not in JavaScript. Literal constant that is not quoted Not-a-Number is represented by NaN, a special value. NaN is commonly used to signal an error condition for a function that should return a valid number since it always compares unequally to any number, including NaN. Differentiating between different undefined values in JavaScript can be tricky. When working with NaN values in Boolean operations, there are a handful of difficulties to be careful of. The numeric type in JavaScript permits you to describe numbers of ... Read More

What is the importance of str.padStart() method in JavaScript?

vineeth.mariserla
Updated on 30-Jun-2020 15:31:18

206 Views

We can attach two strings using the concat() method. But if we need to attach a specific string at the starting of the first string then the easiest way is string.padStart(). This method not only adds the second string at the start of the first string but also looks after the number of characters to be added. It basically takes two parameters one is the length and the other is second string. The method string.padStart() add the second string to the first based on the length provided to it.syntaxstring.padStart(length, "string");It takes the length as the parameter to concise the resulted string to those ... Read More

How to concatenate two strings so that the second string must concatenate at the end of first string in JavaScript?

vineeth.mariserla
Updated on 27-Jul-2022 07:58:42

1K+ Views

concat() methodThe fundamental operation for combining two strings is concatenation. String combining is a necessary part of programming. We need to first clear out the fundamentals before we can discuss "String Concatenation in JavaScript." A new string is produced when an interpreter performs the operation.In order to create a new string, the concat() method joins the calling string and the string arguments. The initial string and the string that was returned are unaffected by changes to either.When concatenating, string values are first transformed from parameters that are not of the type string.SyntaxFollowing is the syntax of concat() methodconcat(str1) concat(str1, str2) ... Read More

How to modify an array value of a JSON object in JavaScript?

Sai Teja Kotha
Updated on 07-Dec-2022 12:59:09

8K+ Views

In this article, we are going to discuss how to modify an array value of a JSON object in JavaScript. We try to update a new value or modify the existing value in an array. Modifying an array is just like modifying an object when that array is inside the object. The normal general principles of modifying will apply here. Syntax Following is the syntax of the for…in statement. for (var in obj) { //code } Example 1 In this example, we are trying to loop through an array using the for…in statement. This statement ... Read More

How to get the Width and Height of the screen in JavaScript?

Sai Teja Kotha
Updated on 07-Dec-2022 12:51:20

9K+ Views

In this article, we are going to discuss how to get the width and height of the screen in JavaScript. Javascript provides an window.screen object that contains information regarding the user's screen. The information includes height and width, and also many other features. To find the height and width of the screen you need to use the following read-only properties Screen.height − This property is used to get the height of the screen in pixels. Screen.width − This property is used to get the width of the screen in pixels. Syntax Following is the syntax of the height ... Read More

How to find whether a provided number is safe integer or not in JavaScript?

Aman Kumar
Updated on 06-Dec-2022 08:07:15

314 Views

Java script provides a Number.isSafeInteger() to check whether the given number is a safe integer or not. If the integer is safe then returns true otherwise it will return false.. JavaScript has some restrictions regarding the number, any number should be in an SCNF standardized computer network format. If a number breaches the rule, then it is not a safe integer. The reason behind that the number is that JavaScript uses double-precision floating-point format numbers as specified in IEEE 754 and can only safely represent integer b/w −(2^53-1) and (2^53-1) Example 1 In the following example, we check the ... Read More

How to compare dates in JavaScript?

Aman Kumar
Updated on 06-Dec-2022 08:02:13

3K+ Views

Dates can be compared easily in the JavaScript the dates can belong to any frame like past, present, or future. Past dates can be compared to the future and the future can be compared to the past and present. The date object will do what you want to construct one for each, then compare them using the ( >, today) { var date = "The date you provide is a future date"; } else { var ... Read More

What is the use of parsing dates in JavaScript?

Aman Kumar
Updated on 06-Dec-2022 07:59:41

185 Views

The date. parse() method parsing a string representation of a date, and returns the number of milliseconds. parse() parse a date string and returns the time difference between midnight 1, 1970 to provided date. The date. parse() method is used to know the exact number of milliseconds that have passed from midnight, January 1, 1970, till the date we provide. Syntax Following is the syntax of the parse() function − Date.parse(dateString) This method accepts only one parameter and holds the date as a string. It returns an integer value that represents the number of milliseconds between January 1, 1970, ... Read More

How to invoke a function with a function constructor in JavaScript?

Aman Kumar
Updated on 06-Dec-2022 07:53:41

1K+ Views

A function constructor invocation creates a new object. The new object inherits the properties and methods from the constructor. This keyword in the constructor does not have a value. This value will be a new object created when the function is invoked. Function construction creates functions that execute the global scope only. In JavaScript invoking a function with a function, the constructor is different from invoking a function as a method or invoking a function. Because it creates a new object that constructs properties and methods. Syntax Following is the snippet invoking a function with a function constructor. Here, we are ... Read More

Advertisements