How-to articles, tricks, and solutions about VARIABLE

Bind variable inside angularjs directive isolated scope

AngularJS is a JavaScript-based open-source front-end web framework. Read information about the isolated scope methods and the types of AngularJs directive scope. Also, see examples of how to do it.

How to Add Days to JavaScript Date

Read the tutorial and learn a simple method of adding days to JavaScript date with two inbuilt functions used for setting and getting the day of the month.

How to Append an Item to an Array in JavaScript

On this page, you can learn the ways of appending an item or multiple items to an array in JavaScript.

How to Change Variables from Outside of a Directive

The way of changing variables depends on the type of scope. See how to change for each type of scope: not inherit, inherit and isolated.

How to Check if a Value is an Object in JavaScript

Checking the data type of the value can be misleading. Read this tutorial and learn which operator is used to check if a value is an object in JavaScript.

How to Check if a Variable is of Function Type

Read this JavaScript tutorial and learn several fast and useful methods that are invoked for checking whether the variable is of function type or not.

How to Check if an Object has a Specific Property in JavaScript

Read this tutorial and learn the methods of checking whether the specified object has the specified property in JavaScript. Find the fastest one for you.

How to Check if Element is Visible after Scrolling

Read the tutorial and find out one of the methods of checking whether the element is visible after scrolling with jQuery. Also, find about utility function.

How to Check if Function Exists in JavaScript

In this tutorial, you will read and learn information about the two methods of checking whether a function exists in JavaScript or it has not been defined.

How to Check if the Variable is Undefined

This tutorial provides the method of checking whether the type of the variable is undefined. Read about the differences between undefined and “undefined”.

How to Convert a Unix Timestamp to Time in JavaScript

Read the tutorial and find how you can convert the UNIX timestamp to time in JavaScript to make the Unix format date-time value in a user-readable format.

How to Convert Object to String

Read this JavaScript tutorial and learn about the fastest methods of converting object into string. Read about JSON.stringify() and toString() methods.

How to Copy Array Items into Another Array

Read this JavaScript tutorial and learn several useful methods of copying array items into another array. Get to know which method to choose for your case.

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 Declare Constants in JavaScript?

Read this tutorial and learn useful information about declaring a constant by using the const keyword which creates a read-only reference to the value.

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 Empty an Array in JavaScript

This tutorial provides useful information about clearing an existing array in JavaScript. Get familiar to multiple methods and find the best one for you.

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 Get the Current Date and Time in JavaScript

The tutorial provides information of getting the current date, time and both by running a simple piece of code. Also, get the full explanation of the code.

How to Get the Value of Selected Option in a Select Box

Read the tutorial and learn the methods of getting the value of the selected option in a select box using jQuery. Read about the text() and val() methods.

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 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 Merge Two Arrays in JavaScript and De-duplicate Items

Read this tutorial and find useful information about the simplest methods that are used for merging two arrays and removing duplicate items in JavaScript.

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.

1 2