Node.js shift() function Last Updated : 30 Mar, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 of the function: Program 1: javascript function shiftDemo() { arr.shift(); console.log(arr); } const arr = [17, 55, 87, 49, 78]; shiftDemo(); Output: [ 55, 87, 49, 78 ] Program 2: javascript function shiftDemo() { arr.shift(); console.log(arr); } const arr = ['a', 'b']; shiftDemo(); Output: [ 'b' ] Program 3: javascript const Lang = ["Python", "C", "Java", "JavaScript"]; while ((i = Lang.shift()) !== undefined) { Lang.shift(); } console.log(Lang); Output: [] Comment More infoAdvertise with us Next Article Node.js GM rotate() Function T Twinkl Bajaj Follow Improve Article Tags : Web Technologies Node.js NodeJS-function Similar Reads Node.js unshift() function 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 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 GM spread() Function The spread() function is an inbuilt function in the GraphicsMagick library which is used to displace image pixels by a random amount. The function returns the true value on success. Syntax: spread(amount) Parameters: This function accepts a single parameter amount which is used to specify the value 1 min read Node.js GM rotate() Function The rotate() function is an inbuilt function in the GraphicsMagick library which is used to rotate the image by the specified angle. The function returns the true value of success. Syntax: rotate( angle, color ) Parameters: This function accepts two parameters as mentioned above and described below 2 min read Node.js GM roll() Function The roll() function is an inbuilt function in the GraphicsMagick library which is used to roll an image vertically or horizontally. The function returns the true value on success. Syntax: roll( x, y ) Parameters: This function accepts two parameters as mentioned above and described below: x: This 1 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 Like