p5.js reverse() function Last Updated : 22 Aug, 2023 Summarize Comments Improve Suggest changes Share 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 Lodash _.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 PHP | DsVector reverse() Function The Ds\Vector::reverse() function is an inbuilt function in PHP which is used to reverse the vector elements in-place. Syntax: void public Ds\Vector::reverse( void ) Parameters: This function does not accepts any parameters. Return Value: This function does not return any value. Below programs illus 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 PHP strrev() Function Reversing a string is one of the most basic string operations and is used very frequently by developers and programmers. PHP comes with a built-in function to reverse strings. The strrev() function is a built-in function in PHP and is used to reverse a string. This function does not make any change 2 min read Like