Skip to main content
100%

JS Bin

✓ Published0🌍 Public
AAlsaxian
Last edited Jan 14, 2020
Created on Jan 14, 2020

This example demonstrates JavaScript object spread and filtering with the rest operator. The code defines a `person` object, creates a `newPerson` object that copies its properties and adds a `gender` field, then logs the result to the console. It also defines a `filter` function that uses the rest parameter to collect all arguments and the `Array.prototype.filter` method to return only elements equal to `1`. The output, logged via `console.log`, shows the new object and the filtered array.

AI-generated description

Similar vizzes