Open In App

Fabric.js removeFromArray() Method

Last Updated : 03 Mar, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

The removeFromArray() method is used to remove a value from the specified array of values.

Syntax:

removeFromArray(array, value)

Parameters: This method accepts two parameters as mentioned above and described below:

  • array: This parameter holds the specified array of values.
  • value: This parameter holds the value which is going to be removed from the array.

Return Value: This method returns the array of remaining values.

Example 1:

Javascript




<!DOCTYPE html>
 
<html>
 
<head>
    <script src=
    </script>
 
    <script type="text/javascript" src=
    </script>
 
    <script type="text/javascript" src=
    </script>
</head>
 
<body>
    <script type="text/javascript">
 
        // Calling removeFromArray() function over
        // some specified arrays and values to be removed
        console.log(fabric.util.removeFromArray([1, 2, 3], 2));
        console.log(fabric.util.removeFromArray([1, 2, 3], 1));
        console.log(fabric.util.removeFromArray([1, 2, 3], 0));
    </script>
</body>
 
</html>


Output:

[1,3]
[2,3]
[1,2,3]

Example 2:

Javascript




<!DOCTYPE html>
 
<html>
 
<head>
    <script src=
    </script>
 
    <script type="text/javascript" src=
    </script>
 
    <script type="text/javascript" src=
    </script>
</head>
 
<body>
    <script type="text/javascript">
 
        // Specifying some arrays
        var array1 = [2, 4, 6];
        var array2 = [1, 3, 4];
 
        // Specifying some values
        var value1 = 2;
        var value2 = 4;
 
        // Calling removeFromArray() function over the
        // above specified arrays and values to be removed
        console.log(fabric.util.removeFromArray(array1, value1));
        console.log(fabric.util.removeFromArray(array2, value2));
    </script>
</body>
 
</html>


Output:

[4,6]
[1,3]


Similar Reads

Fabric.js easeOutElastic() Method
In animation and games, it can be seen that many objects are moving from one point to another linearly. But after using the Easing function, the object's way of progressing can take a different natural and interesting shape. Easing functions is the rate of change of a parameter over time. It is those kinds of equations that move slowly at the start
3 min read
Fabric.js easeOutCubic() Method
In animation and games, it can be seen that many objects are moving from one point to another linearly. But after using the Easing function, the object's way of progressing can take a different natural and interesting shape. Easing functions is the rate of change of a parameter over time. It is that kind of equations that moves slowly at the start
3 min read
Fabric.js camelize() Method
The camelize() method used to camelize a specified string. Syntax: camelize(string) Parameters: This method accepts a parameter as mentioned above and described below: string: This parameter holds the string to camelize. Return Value: This method returns the camelized version of the string. Example 1: C/C++ Code &lt;!DOCTYPE html&gt; &lt;html&gt;
1 min read
Fabric.js easeOutQuad() Method
In animation and games, it can be seen that many objects are moving from one point to another linearly. But after using the easing function, the object's way of progressing can take a different natural and interesting shape. The Easing function is the rate of change of a parameter over time. It is the kind of equation that moves slowly at the start
3 min read
Fabric.js toArray() Method
The toArray() method in Fabric.js is used to convert the specified array-like objects to an array. This can be used to convert an arguments list or a NodeList to an array. Syntax: toArray( arrayLike ) Parameters: This method accepts a single parameter as mentioned above and described below: arrayLike: This parameter holds the specified array-like o
1 min read
Fabric.js extend() Method
The extend() method is used to create a copy of all the properties of the source objects over the destination object and return the destination object. Do not clone or extend fabric.Object subclasses. This is mostly for internal use and has extra handling for fabricJS objects, it skips the canvas property in deep cloning. Syntax: extend(destination
2 min read
Fabric.js invoke() Method
The Fabric.js invoke() method is used to perform certain actions like sorting, joining, etc. on the elements of the specified array. Syntax: invoke(array, method) Parameters: This method accepts two parameters as mentioned above and described below: array: This parameter holds the array to iterate over.method: This parameter holds the name of a met
1 min read
Fabric.js min() Method
The min() method is used to find the minimum value from the specified array. Syntax: min( array ) Parameters: This method accepts single parameter as mentioned above and described below: array: This parameter holds the array to iterate over. Return Value: This method returns the minimum value from the array. Example 1: C/C++ Code &lt;!DOCTYPE html
1 min read
Fabric.js capitalize() Method
The capitalize() method used to capitalize a specified string. Syntax: capitalize(string, firstLetterOnly) Parameters: This method accept two parameters as mentioned above and described below: string: This parameter holds the string that need to capitalize.firstLetterOnly: This parameter is optional and holds a boolean value. If true only the first
1 min read
Fabric.js max() Method
The max() method used to find the maximum value from the specified array. Syntax: max( array ) Parameters: This method accepts single parameter as mentioned above and described below: array: This parameter holds the array to iterate over. Return Value: This method returns the maximum value of the array. Example 1: C/C++ Code &lt;!DOCTYPE html&gt;
1 min read