str_replace PHP function in JavaScript

Working with JavaScript, if one wants to replace a part of a string with another string, usually, the replace String method is used. This method allows to manipulate a string using another string or a regular expression. Next it is shown how it is used:

Read More »

str_pad PHP function in JavaScript

Introduction to str_pad

Many times one needs to fill a string with another string using JavaScript. To achieve this, there is a useful function in PHP called str_pad. This function can pad a string to a certain length with another string. In this way, we are able to achieve that a certain data has always the same length, e.g.:

Read More »