Learning Center
Learning Center
  • HTML
  • CSS
  • JAVASCRIPT
  • Bootstrap
  • React
  • jQuery
  • NodeJs
  • Sql
  • MySql
  • Python
  • OpenVPN Setup
  • Log In
Coding Choice Home About Contact ☰

  1. You are here
  2. Home
  3. javascript
  4. objects_and_arrays

Sidebar
  • Introduction to JS
  • Getting Started with JS
  • Variables in JS
  • Data Types in JS
  • Operators in JS
  • Conditional Statements in JS
  • Loops in JS
  • Functions in JS
  • Objects and Arrays in JS
  • DOM Manipulation in JS
  • Promises in JS
  • Share via
    • Share via...
    • Twitter
    • LinkedIn
    • Facebook
    • Pinterest
    • Telegram
    • WhatsApp
    • Yammer
    • Reddit
    • Teams
  • Send via e-Mail
  • Print
  • Permalink

Objects and Arrays in JS

Objects

let car = {
    brand: "Tesla",
    model: "Model 3",
    year: 2021,
    drive() {
        console.log("Driving...");
    }
};
console.log(car.brand);
car.drive();

Arrays

let fruits = ["apple", "banana", "cherry"];
fruits.push("date");
console.log(fruits);