Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Extract Out a Portion of an Array</title> </head> <body> <script> var fruits = ["Apple", "Banana", "Mango", "Orange", "Papaya"]; var subarr = fruits.slice(1, 3); document.write(subarr); // Prints: Banana,Mango </script> </body> </html>