𝐩𝐨𝐩(): 𝑅𝑒𝑚𝑜𝑣𝑒 an item from the 𝑒𝑛𝑑 of an 𝑎𝑟𝑟𝑎𝑦.
𝐸𝑥𝑎𝑚𝑝𝑙𝑒
let players = ['Shakib', 'Tamim', 'Mushfiq'];
players.pop(); // ['Shakib', 'Tamim']
𝐬𝐡𝐢𝐟𝐭():𝑅𝑒𝑚𝑜𝑣𝑒 an item from the 𝑏𝑒𝑔𝑖𝑛𝑛𝑖𝑛𝑔 of an array.
𝐸𝑥𝑎𝑚𝑝𝑙𝑒
let players = ['Shakib', 'Tamim','Mushfiq' ];
players.shift(); // ['Tamim','Mushfiq']
𝐩𝐮𝐬𝐡(): 𝐴𝑑𝑑 items to the 𝑒𝑛𝑑 of an array.
𝐸𝑥𝑎𝑚𝑝𝑙𝑒
let rivers= ['Meghna'];
rivers.push('Jamuna'); // ['Meghna', 'Jamuna']
𝐮𝐧𝐬𝐡𝐢𝐟𝐭(): 𝐴𝑑𝑑 items to the 𝑏𝑒𝑔𝑖𝑛𝑛𝑖𝑛𝑔 of an array.
𝐸𝑥𝑎𝑚𝑝𝑙𝑒
let fruits= ['Mango'];
fruits.unshift('Orange'); // ['Orange', 'Mango']
Top comments (0)