Thursday, January 2, 2025
Google search engine
HomeLanguagesJavascriptFabric.js invoke() Method

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 method to invoke.

Return Value: This method returns the array formed after the given method is applied to it.

Example 1: This example shows the basic use of the Fabric.js invoke() method.

Javascript




<script src=
</script>
  
<script type="text/javascript" src=
</script>
  
<script type="text/javascript" src=
</script>
  
<script type="text/javascript">
    console.log(fabric.util.array
    .invoke([[1, 6, 8], [7, 5, 3],
    [33, 76, 55]], 'sort'));
</script>


Output:

[[1, 6, 8], [3, 5, 7], [33, 55, 76]]

Example 2: This example shows the basic use of the Fabric.js invoke() method.

Javascript




<script src=
</script>
  
<script type="text/javascript" src=
</script>
  
<script type="text/javascript" src=
</script>
  
<script type="text/javascript">
    console.log(fabric.util.array
        .invoke([[11, 6, 8], 
        [33, 25, 32]], 'join'));
</script>


Output:

["11, 6, 8", "33, 25, 32"]

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments