Yes, you can have an array inside a JavaScript object. An object in JavaScript can store different data types as its properties, including arrays. Here’s an example:
const person = {
name: “John”,
age: 30,
hobbies: [“reading”, “swimming”, “gaming”]
};
console.log(person.hobbies); // Output: [“reading”, “swimming”, “gaming”]
In this example, the person object has a property hobbies, which is an array. You can access the array like any other object property and manipulate it as needed.