Node.js unshift() function Last Updated : 30 Mar, 2023 Suggest changes Share 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' ] Advertise with us Next Article Node.js unshift() function T Twinkl Bajaj Follow 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 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 Article Tags : Web Technologies Node.js NodeJS-function Like