diff --git a/subjects/DPxAI/transform-objects/README.md b/subjects/DPxAI/transform-objects/README.md new file mode 100644 index 000000000..9e8577197 --- /dev/null +++ b/subjects/DPxAI/transform-objects/README.md @@ -0,0 +1,79 @@ +## Transform Objects + +> Mindful AI mode + +### Context + +Imagine your favorite robot friend with all its cool features: a type, weight, and operational status. + +In JavaScript, we use objects to group these properties together, making it easy to manage and tweak our robot’s settings. Let’s see how we can modify, add, or remove properties in a JavaScript object to make our robot even cooler! + +### AI-Powered Learning Techniques + +`Reflective Technique:` +This type of prompt encourages the AI to help learners reflect on their understanding by asking questions and prompting them to think critically about the concepts. + +Find the examples across the subject ;) + +### Concepts + +### Modifying Objects + +Let's start with a robot object: + +```js +const robot = { + points: 0, + code: "75lai78wn", +}; +``` + +### Adding a New Property + +Give your robot a name: + +```js +robot.name = "RoboMax"; +``` + +### Changing a Property Value + +Boost your robot’s points: + +```js +robot.points = 10; +``` + +### Removing a Property + +Remove a property: + +```js +robot.code = undefined; +``` + +#### **`Prompt Example`**: + +- "How does modifying an object's property differ from adding a new property or removing an existing one?" + +- "Can you think of a scenario where using an object to group related properties would be more beneficial than using separate variables?" + +### Instructions + +#### Task 1: + +Modify the provided robot variable: + +- Add a `model` property with the string value 'RX-78'. +- Add a `fullName` property that is the joined value of the brand and the model with a space in between. +- Add `10` to its `batteryLevel` property. + +#### Task 2: + +Let's move away from objects a bit, and discover a notion we will use later. `Duplicating a String with Placeholders`! + +Declare a variable `duplicate` that repeats the provided variable sentence, separated by a comma, and adds an exclamation mark at the end. + +> For example, if sentence is "Hello there", we expect "Hello there, Hello there!". + +**What a good occasion to apply what you learned in using generative AI and documentations to understand duplicating a string with placeholders! Now you are capable to find the information everywhere;)**