• Substring is basically a part of string which you want to extract from a given string.   There are 3 of methods in JavaScript which can do the job for you. substring():  This method takes 2 parameters.  The first parameter is start and second parameter is end.  Both the parameters take […]

    Substrings in JavaScript

    Substring is basically a part of string which you want to extract from a given string.   There are 3 of methods in JavaScript which can do the job for you. substring():  This method takes 2 parameters.  The first parameter is start and second parameter is end.  Both the parameters take […]

    Continue Reading...

  • As you know, replace() function is used to replace value in a given string.  It also takes regex as parameter to perform the search for replacement.  With regex, you can perform 2 kinds of searches, global case-sensitive and global case-insensitive.  For global case-sensitive search, we add g at the end […]

    String Replace Function with RegEx in JavaScript

    As you know, replace() function is used to replace value in a given string.  It also takes regex as parameter to perform the search for replacement.  With regex, you can perform 2 kinds of searches, global case-sensitive and global case-insensitive.  For global case-sensitive search, we add g at the end […]

    Continue Reading...

  • We have couple of functions to manipulate strings in JavaScript.  Mostly commonly used functions are given below with example. toUpperCase():  This function will change the case of a string to upper. toLowerCase():  This function will change the case of a string to lower. trim():  This function will remove any extra […]

    String Functions in JavaScript

    We have couple of functions to manipulate strings in JavaScript.  Mostly commonly used functions are given below with example. toUpperCase():  This function will change the case of a string to upper. toLowerCase():  This function will change the case of a string to lower. trim():  This function will remove any extra […]

    Continue Reading...

  • In JavaScript, we have some characters which have some special meaning.  For example, a string is always surrounded by double quotation marks or single quotation marks.  First quotation mark determines the start of a string and second quotation mark determines the end of a string. But in case, you want […]

    Escape Sequence Character in JavaScript

    In JavaScript, we have some characters which have some special meaning.  For example, a string is always surrounded by double quotation marks or single quotation marks.  First quotation mark determines the start of a string and second quotation mark determines the end of a string. But in case, you want […]

    Continue Reading...

  • NaN stands for not a number in JavaScript.  Floats and integers are basically numbers.  IsNaN() function checks whether the value is number or not.  It will return true or false. This function will be helpful in case you want to avoid users from passing any value other than a number.   […]

    isNaN() Function in JavaScript

    NaN stands for not a number in JavaScript.  Floats and integers are basically numbers.  IsNaN() function checks whether the value is number or not.  It will return true or false. This function will be helpful in case you want to avoid users from passing any value other than a number.   […]

    Continue Reading...

  • Floats are decimal numbers.  Similar to previous tutorial, if a float number is inside a quotation marks, it is treated as string by JavaScript.  To convert a string to float, we make use of parseFloat() function.  Example is given below. [crayon-599797dad6155622244111/]

    String to Float Conversion in JavaScript

    Floats are decimal numbers.  Similar to previous tutorial, if a float number is inside a quotation marks, it is treated as string by JavaScript.  To convert a string to float, we make use of parseFloat() function.  Example is given below. [crayon-599797dad6155622244111/]

    Continue Reading...

  • We have seen in previous tutorial that JavaScript treat a number as a string if you assign it using quotation marks.  Instead of addition of 2 numbers, it will perform concatenation.  To overcome this issue, we make use of parseInt() function in JavaScript.  This function will convert string to integer.  […]

    String to Integer Conversion in JavaScript

    We have seen in previous tutorial that JavaScript treat a number as a string if you assign it using quotation marks.  Instead of addition of 2 numbers, it will perform concatenation.  To overcome this issue, we make use of parseInt() function in JavaScript.  This function will convert string to integer.  […]

    Continue Reading...

  • For string concatenation in JavaScript, we make use of plus (+) operator or concat function.  But the interesting part is, the plus (+) operator is also used for adding 2 numbers.  It all depends upon how you assign a value to a variable.  A string is always surrounded by quotes […]

    String Concatenation in JavaScript

    For string concatenation in JavaScript, we make use of plus (+) operator or concat function.  But the interesting part is, the plus (+) operator is also used for adding 2 numbers.  It all depends upon how you assign a value to a variable.  A string is always surrounded by quotes […]

    Continue Reading...

  • Comments in JavaScript are pretty much similar to PHP.  There are 2 types of comments, single-line comment and multi-line comment.  Single-line comment is useful in case of providing small information about the code.  Multi-line comment is useful in case of providing detailed information about the code.  Single-line comment starts with […]

    Comments in JavaScript

    Comments in JavaScript are pretty much similar to PHP.  There are 2 types of comments, single-line comment and multi-line comment.  Single-line comment is useful in case of providing small information about the code.  Multi-line comment is useful in case of providing detailed information about the code.  Single-line comment starts with […]

    Continue Reading...

  • It is a very common question where you should place your script tag.  Few people prefer placing it after head tag and few prefer placing it somewhere in the body tag.  If there is no manipulation of HTML elements on page load, then it is okay to place it in […]

    Placement of Script Tag in HTML File

    It is a very common question where you should place your script tag.  Few people prefer placing it after head tag and few prefer placing it somewhere in the body tag.  If there is no manipulation of HTML elements on page load, then it is okay to place it in […]

    Continue Reading...

Page 1 of 212