Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • JS Tutorial
  • JS Exercise
  • JS Interview Questions
  • JS Array
  • JS String
  • JS Object
  • JS Operator
  • JS Date
  • JS Error
  • JS Projects
  • JS Set
  • JS Map
  • JS RegExp
  • JS Math
  • JS Number
  • JS Boolean
  • JS Examples
  • JS Free JS Course
  • JS A to Z Guide
  • JS Formatter
Open In App
Next Article:
Javascript Map Programming Examples
Next article icon

JavaScript Array Examples

Last Updated : 20 Nov, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

JavaScript array is used to store multiple elements in a single variable.

JavaScript
let a = ["HTML", "CSS", "JS"] console.log(a) 

Output
[ 'HTML', 'CSS', 'JS' ] 
JavaScript-Array-Programming-Examples

Using New Keyword

JavaScript
// Declaring an array using Array Constructor let a = new Array(3) a[0] = "HTML" a[1] = "CSS" a[2] = "JS" console.log(a) 

Output
[ 'HTML', 'CSS', 'JS' ] 

All the JavaScript array-related articles into three sections based on their difficulty levels: Easy, Medium, and Hard. This organization aims to help learners gradually progress from basic to more complex concepts.

Easy:

The Easy level includes articles that cover fundamental operations and straightforward tasks with JavaScript arrays.

  • Insert an Element
  • Remove Element
  • Remove Duplicates
  • Get a Value from a JSON Array
  • Replace an Item
  • Find Duplicates
  • Select a Random Element
  • Insert at Specific Index
  • Get Array Length
  • An Array of Given Size
  • Append in an Array
  • First and Last in an Array
  • Reverse an Array
  • Empty an Array in JavaScript
  • Convert an Array into a String
  • Search an Element
  • Largest in an Array
  • First N from an Array

Medium:

The Medium level includes articles that delve deeper into working with JavaScript arrays, exploring more advanced operations and methods:

  • Modify an Object's Property in Array Objects
  • Sort Object Array by Date
  • Copy Items into Another Array
  • Count Occurrences of All Items
  • Convert Array to Object
  • Compare Two Arrays
  • Add Object to Array
  • Create Comma Separated List
  • Find the Min/Max Element
  • Clone an Array
  • Create HTML List
  • Convert String to Array
  • Convert Set to Array
  • Create 2D Array
  • Sum Array Elements
  • Create 1 to N Array
  • Delete Item from Array
  • Find an Item in Array
  • Add Elements to Start
  • Loop Through Object
  • Remove Object by Property
  • Move an Array Element
  • Store Array in LocalStorage
  • Remove Empty Elements
  • Convert Byte Array to String
  • Sort Numeric Array
  • Find Object Index
  • Change the Array Value
  • Find the Most Frequent Element
  • Most Frequently Element
  • Map in Reverse Order
  • Calculate Standard Deviation
  • Find the Missing Number
  • Remove Falsy Values
  • Remove Min/Max Elements
  • Find First Non-Repeated Element
  • Find the Majority Element
  • Get All Non-Unique Values
  • Find Minimum Repeating Index

Hard:

The Hard level includes articles that cover more intricate and less common tasks

  • Remove Duplicates from Array Objects
  • Get Distinct Object Values
  • Convert Object into Array Objects
  • Convert Array of Objects to a Map
  • Split an Array into Chunks
  • Check Array for Substring
  • Remove Multiple Items
  • Find Second Largest
  • Convert Map Keys to Array
  • Group Objects by Property
  • Sort Words Alphabetical
  • Quick Sort
  • Check Value at Index
  • List Array Keys
  • Find Find Target Index
  • Merge Arrays In-Place
  • Remove Null Objects
  • Sort Array by Values
  • Find Next Smaller Element
  • Sort 1 to N Array
  • Find Largest Subarray Divisible by K
  • Find K Most Frequent
  • Count Unequal Pairs
  • Sparse Table
  • Rotation Count
  • Array from Pair Sum
  • Find Union and Intersection
  • Count Numbers Less or Equal
  • Find Median in a Stream
  • OR and AND of Elements
  • Max Profit with Share
  • K-th Largest Sum
  • Max Distance Between Element
  • Calculate Mean
  • Search Rotated Array
  • Range Sum Query
  • Rearrange in Max-Min Form
  • Transpose 2D Array
  • Longest Consecutive Sequence
  • Sort Array Objects by Property
  • Merge Sort
  • Square Root (Sqrt) Decomposition
  • Rearrange Even/Odd Positions
  • Shortest Distance Between Words
  • Filter Array Objects in ES6
  • Compare Array Objects
  • Find Object Property Values
  • Create Range Array
  • Find Nth Smallest/Largest Element
  • Store Dates in Range
  • Sort Mixed Data Type Array
  • Count Data Types
  • Find Unique Elements from Two Arrays
  • Minimum Swaps to Sort
  • Reorder an Array
  • Unique Values from Arrays
  • Swap Variables
  • Swap First and Last Elements
  • Split Map Keys and Values
  • Find the K-th Largest Sum
  • Find Max Distance Between Element
  • Unique Elements Check
  • Create Intersection of Two Arrays
  • Create Pre-Filled Array
  • Remove Objects from Associative Array
  • Ungroup Elements from Zipped Array
  • Create Unique Array with Set
  • Loop Through Array
  • Find Top Three Elements
  • Merge Two Sorted
  • Find Nth Smallest/Largest Element
  • Convert CSV to 2D Array
  • Short Circuit forEach
  • Find the Largest Subarray with Sum K
  • Left Rotate by One
  • Search Rotated Array
  • Construct an Array from Its Pair Sum Array
  • Space Optimization Using Bit Manipulations
  • Construct Array from Sum
  • Find Max Profit wih Share
  • Find K Most Occurrences

Recommended Links:

  • Interesting Facts about JavaScript Arrays
  • JavaScript Array Complete Reference
  • JavaScript Tutorial
  • Recent articles on JavaScript

Next Article
Javascript Map Programming Examples

V

vishalkumar2204
Improve
Article Tags :
  • JavaScript
  • Web Technologies
  • javascript-array

Similar Reads

    JavaScript Programs
    JavaScript Programs contains a list of articles based on programming. This article contains a wide collection of programming articles based on Numbers, Maths, Arrays, Strings, etc., that are mostly asked in interviews.Table of ContentJavaScript Basic ProgramsJavaScript Number ProgramsJavaScript Math
    13 min read
    JavaScript Array Examples
    JavaScript array is used to store multiple elements in a single variable. JavaScriptlet a = ["HTML", "CSS", "JS"] console.log(a)Output[ 'HTML', 'CSS', 'JS' ] Using New KeywordJavaScript// Declaring an array using Array Constructor let a = new Array(3) a[0] = "HTML" a[1] = "CSS" a[2] = "JS" console.l
    3 min read
    Javascript Map Programming Examples
    A Javascript map is a collection of elements where each element is stored as a Key, value pair. Map objects can hold both objects and primitive values as either key or value. When we iterate over the map object it returns the key, and value pair in the same order as inserted.Javascript Map Programmi
    3 min read
    JavaScript Math Programming Examples
    The JavaScript Math Object is used to perform mathematical operations on numbers. The Math object does not have a constructor. All properties and methods of Math are fixed/static. All properties and methods of Math are static and can be called by using Math as an object.JavaScript Math Programming E
    2 min read
    JavaScript Number Programming Examples
    Javascript Numbers are primitive data types. Unlike other programming languages, Both integers and floating-point values are represented by JavaScript's number type. The IEEE-754 format is the one that is technically used by the JavaScript number type. Here, you don’t need int, float, etc, to declar
    3 min read
    JavaScript Object Programming Examples
    JavaScript Object is the collection of properties and the property is in key, value pair format. These objects are quite different from JavaScript’s primitive data types (Number, String, Boolean, null, undefined, and symbol) in the sense that these primitive data types all store a single value each
    6 min read
    JavaScript Set Programming Examples
    In JavaScript, the Set is a built-in collection that allows you to store unique values of any type, Set can store any type of value whether primitive or objects. It provides methods for adding, removing, and querying elements in an efficient way.JavaScriptlet s = new Set(["a", "b", "c"]); console.lo
    1 min read
    JavaScript String Exercise
    JavaScript string is a primitive data type and is used for storing and manipulating a sequence of characters. It can contain zero or more characters within single or double quotes. This article contains a wide collection of JavaScript Programming examples based on String. JavaScriptlet s = "Geeksfor
    7 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences