How-to articles, tricks, and solutions about FUNCTION

How to Copy the Text to the Clipboard with JavaScript

Copying the text to clipboard makes it easier using the web page, so users will definitely like this functionality. You can create it by the help of JavaScript and we’re here to help you.

How to Count String Occurrence in String

Read this tutorial and learn several useful methods that are used to count the string occurrence in a string. Choose one of the working methods for you.

How to Count the Pages in a PDF File with PHP

PHP provides a range of extensions and functions for getting the number of pages in a PDF document. Let’s check out the most efficient ones, here.

How to Create a New DOM Element from HTML String

Read this JavaScript tutorial and find the method that is used for creating a new DOM element from an HTML string. Get the explanation and see examples.

How to Create an Array Containing 1…N

Read this JavaScript tutorial and get information concerning the problem of creating an Array that contains 1 through to N. Find two methods for solving it.

How to Define Global Variable in a JavaScript Function

Read the tutorial and learn how to define a global variable in a JavaScript function. Also, read about the differences about the global and local variables.

How to Delete the First Character of a String in JavaScript

Read this tutorial and learn some useful information about the methods that are used for deleting the first character of a string in JavaScript easily.

How to Detect Idle Time in JavaScript

Read this tutorial and learn useful information about the vanilla JavaScript and jQuery solutions that are used for detecting the idle time correctly.

How to Execute a JavaScript Function when You have Its Name as a String

Read this tutorial and learn about the safe method of calling a function when you have its name as a string. Also, read about why you should not use eval().

How to Find out the Caller Function in JavaScript

Read this JavaScript tutorial and learn the accepted method of finding out the call stack. Get information about the obsolete method of getting the call.

How to Find the Sum of an Array of Numbers

Read this JavaScript tutorial and learn several methods used to find or calculate the sum of an array of numbers. Also, find which is the fastest one.

How to Get a Class Name of an Object

Read this tutorial and learn information about several methods that are used for getting the class name of the object in JavaScript. Also, try examples.

How to get a function name as a string?

In Python, you can use the built-in function attribute __name__ to get the name of a function as a string.

How to Get Query String Values in JavaScript

On this page, you can find fast and simple solutions on how to get query string values in JavaScript. Just follow the examples given below to make it work.

How to Get the Browser Viewport Dimensions

Read this JavaScript tutorial and learn information about two sets of properties that are used to obtain the height and width of the viewport dimension.

How to HTML-encode a String

Read this JavaScript tutorial and learn about some useful and fast methods that help you to HTML-encode the string without causing the XSS vulnerability.

How to Include a JavaScript File in Another JavaScript File

Read the tutorial and find out different approaches to including a JavaScript file in another JavaScript file. Also, find a brief representation of methods.

How to Make JavaScript Execute After Page Load

Read this JavaScript tutorial and learn which are the two most used methods of making the script execute as soon as the webpage has completely loaded.

How to Manage a Redirect Request after a jQuery Ajax Call

In this JavaScript tutorial, you will read and learn detailed information about the method used for managing a redirect request after a jQuery Ajax call.

How to Measure Time Taken by a Function to Execute

Read this JavaScript tutorial and learn several fast and useful methods that are used to calculate the time taken by a function to execute in milliseconds.

How to Move an Array Element from One Array Position to Another

In this JavaScript tutorial, you will read and learn information about an easy insert strategy method of moving the array element to another position.

How to Pass a Parameter to a setTimeout() Callback

Read this JavaScript tutorial and learn the right way of passing a parameter to a setTimeout() callback. Also, get information about function binding.

How to Pass Variables by Reference in PHP

Working with variables is an essential part of a developer’s life. In this snippet, we will demonstrate to you how to pass variables by reference with PHP.

How to Randomize (shuffle) a JavaScript Array

In JavaScript, there no any built-in method of shuffling a JavaScript array. Read this tutorial and learn what is the popular method of randomizing arrays.

How to Remove All CSS Classes Using jQuery/JavaScript

In this tutorial, you can read and learn several easy and simple jQuery methods and pure JavaScript properties that are used to remove all CSS classes.