Here are some examples of creating sample objects:
function createSampleObjects() { // Object with string values var person = { name: "John Doe", age: "30", occupation: "Engineer" }; // Object with number values var product = { id: 12345, price: 9.99, quantity: 5 }; // Object with boolean values var settings = { isEnabled: true, isEditable: false, isResizable: true }; // Object with mixed value types var car = { make: "Toyota", model: "Camry", year: 2022, isElectric: false }; // Logging the objects console.log(person); console.log(product); console.log(settings); console.log(car); }
In this example, four different objects are created with different types of values:
personis an object that stores information about a person, such as their name, age, and occupation. The values are of type string.productis an object that represents a product, with properties like ID, price, and quantity. The values are of type number.settingsis an object that holds various settings, such as whether certain options are enabled, editable, or resizable. The values are of type boolean.caris an object that represents a car, with properties like make, model, year, and whether it is electric. The values are of different types, including string, number, and boolean.
After creating the objects, the example logs the objects to the console, displaying their key-value pairs.
You can call the createSampleObjects function to see the objects and their properties in the console output.
Please note that OfficeScripts are only supported in Excel for the web and Excel Online, and they may have limitations compared to other programming environments.

