Node.js unshift() function Last Updated : 30 Mar, 2023 Comments Improve Suggest changes Like Article Like Report unshift() is an array function from Node.js that is used to insert elements to the front of an array. Syntax: array_name.unshift(element) Parameter: This function takes a parameter that has to be added to the array. It can take multiple elements also as parameters. Return type: The function returns the array after adding the element. The program below demonstrates the working of the function: Example 1: javascript function unshiftDemo() { const element = arr.unshift(12); console.log(arr); } const arr = [1, 5, 7, 9, 78]; unshiftDemo(); Output: [12,1,5,7,9,78] Example 2: javascript function addLang() { const element = arr.unshift("Node.js", "php"); console.log(arr); } const arr = ["C", "Java", "JavaScript", "Python"]; addLang(); Output: [ 'Node.js', 'php', 'C', 'Java', 'JavaScript', 'Python' ] Comment More infoAdvertise with us Next Article Node.js unshift() function T Twinkl Bajaj Follow Improve Article Tags : Web Technologies Node.js NodeJS-function Similar Reads Node.js shift() function shift() is an array function from Node.js that is used to delete elements from the front of an array. Syntax: array_name.shift() Parameter: This function does not take any parameter. Return type: The function returns the array after deleting the element. The program below demonstrates the working 1 min read Node.js push() function push() is an array function from Node.js that is used to add elements to the end of an array. Syntax:array_name.push(element)Parameter: This function takes a parameter that has to be added to the array. It can take multiple elements also. Return type: The function returns the array after adding the 1 min read Node.js split() Function Splitting a string is one of the most widely used functions by the split() method, which splits a string into an array of substrings. This function belongs to the prototype in JavaScript and is applied in many kinds of activities like data parsing from files, extracting information from URLs, or tex 2 min read Node.js sort() function sort() is an array function from Node.js that is used to sort a given array. Syntax: array_name.sort() Parameter: This function does not take any parameter. Return type: The function returns the sorted array. The program below demonstrates the working of the function: Program 1: javascript function 1 min read Node.js pop() function pop() is an array function from Node.js that is used to remove elements from the end of an array. Syntax: array_name.pop() Parameter: This function does not take any parameter. Return type: The function returns the array. The program below demonstrates the working of the function: Example 1: javascr 1 min read Tensorflow.js tf.unstack() 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 Node.js GM chop() Function The chop() function is an inbuilt function in the GraphicsMagick library which is used to remove pixels from the interior of an image. The function returns the true value of success. Syntax: chop( width, height, x, y ) Parameters: This function accepts four parameters as mentioned above and describ 2 min read Node.js GM flip() Function The flip() function is an inbuilt function in the GraphicsMagick library which is used to create a mirror image in the vertical direction. The function returns the true value of success. Syntax: flip() Parameters: This function does not accept any parameters. Return Value: This function returns th 1 min read PHP | DsDeque unshift() Function The Ds\Deque::unshift() function is an inbuilt function in PHP which is used to add the value in front of the deque. Syntax: void Ds\Deque::unshift( $values ) Parameters: This function accepts single parameter $values which holds the values to add in the front of the deque. Return Value: This functi 2 min read Node.js fs.fchown() Function The fs.fchown() method is used to change the owner and group of the given file descriptor. The function accepts a user id and group id that can be used to set the respective owner and group. It has a callback function that returns any error that may occur if the function fails. Syntax: fs.fchown( fd 3 min read Like