Html background image full screen | Responsive background image

Use img tag and CSS code to get the HTML webpage full screen background image. Another way is use background image CSS code. Examples of Html background image full screen Full-screen responsive background image example code.

Output: Html background image full screen without CSS Well, if you don’t want to use an external or Read More…


JavaScript if not equal (!==) operator | Example code

JavaScript if not means simply if the value of two operands are not equal it returns true. You have to use not equal in if/else statement. How to representation not equal in JS? Here is symbol representation of not equal !=. Note: ! (negation operator) as “not”, || (boolean-or operator) as “or” Example of JavaScript Read More…


JavaScript absolute value | abs method example code

Use the abs method to get absolute value in JavaScript. JavaScript Math.abs() method is return the absolute value of a number. It takes a number as a parameter. Syntax of abs method

Example of JavaScript absolute value Basic Example

Output: More Examples

Q: How to get the absolute value of a number Read More…


JavaScript truncate number | trunc( ) Method example

Use trunc() method in JavaScript to get truncate number. Where this method returns the integer part of a number. It’ simply remove the decimals. Note: This method will NOT round the number up/down to the nearest integer. Syntax

Example of JavaScript truncate number | trunc( ) Method Let’s cuts off the dot and the Read More…


JavaScript round method | Up-Down, Up to decimal example code

The javaScript round method is used to rounds a number to the nearest integer. It can do round up or round down a number. You have to just pass the number as a parameter into the method. Syntax

Examples of the JavaScript round method Let’s do round a number to the nearest integer in Read More…


JavaScript truncate decimal | Math.trunc() function Example code

ECMAScript 6 offers Math.trunc method for completely consistent truncation. If you have a number than use this method to truncate decimal in JavaScript. JavaScript Math module trunc() function returns the integer part of a number by removing any fractional digits. Syntax of Math.trunc()

Example of JavaScript truncate decimal See below example doesn’t do any Read More…


JavaScript toFixed method | Rounding number to specified decimals

JavaScript toFixed method formats a number with a specific number of digits to the right of the decimal. This means you can set numbers to a fixed decimal length. Note: It converts a number into a string and rounding to a specified number of decimals. Zero added at decimal point, if the given number of Read More…


JavaScript toPrecision method | format a number to a specific precision or length

JavaScript toPrecision is used to format a number to a specific precision or length. Basically its specified length of number. Note: Js toPrecision method returns a string representing the Number object to the specified precision/length. Syntax

Example of JavaScript toPrecision method Example of How to JavaScript Format a number into a specified length.

Read More…


JavaScript divide integer | Round up/down examples code

How to do integer division in JavaScript where output should be in int not float? Dividing integer is very easy in JavaScript, but some time you will get the output in floating point. To get eliminate floating point you can use math floor method. Normal division

Complete code JavaScript integer division round up

Read More…


JavaScript random integer between 0 and ‘x’ | Example code

Use the basic Math methods to get a random integer in JavaScript. The math random() method returns a random number between 0 and 1 (including 0, excluding 1). You can Multiply this number by the highest desired number (e.g. 10) and Round it downward to its nearest integer. Example of JavaScript random integer Example of Read More…