Using the JavaScript ParseInt Method


JavaScript’s parseInt function is all about converting a string to an integer. The function takes a string value as an argument and converts it to a numerical value with no decimal places, or alternatively the value NaN. ParseInt has a total of two parameters and thus takes two arguments. The second parameter specifies a radix value (i.e., a value representing the mathematical base that will be used when converting the string value to a number). A simple example using the conventional base-10 (decimal) counting system looks like this: [crayon-5744748094771877588074/] Live code example: If no argument is passed to parseInt for the radix value, the default value of base-10 will likely be employed. Alternatively, you can 2 for the radix value to tell the parseInt function to use the binary (base-2) numbering system; a value of 8 will tell parseInt...

Read more

How to Reload a Page in JavaScript?

Refreshing or reloading a web page in JavaScript isn’t all that difficult… Read more

Using the JavaScript Apply Method

Functions are one of JavaScript’s most powerful features. Functions in JavaScript allow… Read more

Ng-if Examples, Use Cases, and Caveats

Ng-if is a built-in Angular directive for adding and removing content from… Read more

Working with State in React.js

In this tutorial we are going to get upto speed with some… Read more

An Array of JavaScript Array Tricks

JavaScript Array Tricks Table of Contents: Avoiding the Index Prepositional Soup: From… Read more

angular.bootstrap Explained in 3 Examples

By default, an Angular application is initialized automatically by loading the angular.js… Read more

Insert, Remove, and Replace elements with Array.splice()

When you already have an existing array and need to make some… Read more

Learn JavaScript Basics: Basic Features

Variables Variables are a means for holding on to or pointing to… Read more

Learn JavaScript Basics: Overview and Setup

What is this Course? This course is intended to be a beginner’s… Read more