p5.js reverse() function Last Updated : 22 Aug, 2023 Comments Improve Suggest changes Like Article Like Report The reverse() function in p5.js is used to reverse the order of the given array element. Syntax: reverse(Array) Parameters: This function accepts a parameter Array whose elements are to be reversed. Return Value: It returns a new reversed array. Below program illustrates the reverse() function in p5.js: Example: This example uses reverse() function to reverse the order of the given array element. javascript function setup() { // Creating Canvas size createCanvas(500, 90); } function draw() { // Set the background color background(220); // Initializing the arrays let Array1 = ['IT', 'CSE', 'ECE']; let Array2 = ['Civil', 'Mechanical']; // Calling to reverse() function. let Array3 = reverse(Array1); let Array4 = reverse(Array2); // Set the size of text textSize(16); // Set the text color fill(color('red')); // Getting new reversed array text("First reversed array is : " + Array3, 50, 30); text("Second reversed array is : " + Array4, 50, 50); } Output: Reference: https://p5js.org/reference/#/p5/reverse Comment More infoAdvertise with us Next Article Tensorflow.js tf.reverse() Function K Kanchan_Ray Follow Improve Article Tags : JavaScript Web Technologies JavaScript-p5.js Similar Reads p5.js | reverseBuffer() Function The reverseBuffer() function is an inbuilt function in p5.js library. This function is used to reverse the p5.soundfile buffer source and the playback should be handled separately. Syntax: reverseBuffer() Note: All the sound-related functions only work when the sound library is included in the head 1 min read p5.js | reverseBuffer() Function The reverseBuffer() function is an inbuilt function in p5.js library. This function is used to reverse the p5.soundfile buffer source and the playback should be handled separately. Syntax: reverseBuffer() Note: All the sound-related functions only work when the sound library is included in the head 1 min read Lodash _.reverse() Function Lodash _.reverse() is used to reverse the array. This function changes the original array and also returns a new array.Syntax:Â _.reverse( array )Parameters: This function accepts a single parameter array that holds the array of elements.Return Value: It returns the reversed array.Note: Please instal 2 min read Tensorflow.js tf.reverse() Function Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. It also helps the developers to develop ML models in JavaScript language and can use ML directly in the browser or in Node.js. The tf. 1 min read Underscore.js _.negate() Function Underscore.js is a JavaScript library that provides a lot of useful functions that help in the programming in a big way like the map, filter, invoke, etc even without using any built-in objects. The _.negate() function is an inbuilt function in Underscore.js library of JavaScript which is used to fi 1 min read PHP | DsSequence reversed() Function The Ds\Sequence::reversed() function is an inbuilt function in PHP which is used to return the reverse copy of sequence element. Syntax: Ds\Sequence abstract public Ds\Sequence::reversed ( void ) Parameters: This function does not accepts any parameter. Return Value: This function returns the revers 2 min read Like