Are you ready to cook? But instead of cooking food, we'll be applying recipes to data through methods! In JavaScript, methods are special functions called from another value, allowing you to perform various operations.
Let's find out more!
### AI-Powered Learning Techniques
`Guided Practice Technique:`
This type of prompt encourages the AI to guide learners through hands-on practice exercises, providing immediate feedback and helping them build confidence in their skills.
Find the examples across the subject ;)
### Concepts
### Functions and Methods
In JavaScript, functions are like recipes that perform a task. Methods are special functions associated with objects. We are focusing on methods now.
### Example
```js
console.log("Robot is mixing ingredients");
```
### Multiple Arguments
Functions can take multiple arguments, like adding ingredients to a recipe:
```js
console.log("flour", 200); // both arguments will appear in your console
We provide you with three robot objects assigned to their respective variables `martin`, `kevin`, and `stephanie`. Use the `Math.max` function on their `age` properties to find the oldest robot.
You need to slice some virtual vegetables. Using the `.slice` method and the provided alphabet variable, which is a string of all the characters in the alphabet:
- Declare a `cutFirst` variable that removes the first `10` characters of alphabet, simulating the removal of the first few slices.
- Declare a `cutLast` variable that removes the last `3` characters of alphabet, simulating the trimming of the last few slices.
- Declare a `cutFirstLast` variable that removes the first `5` characters and the last 6 characters of alphabet, simulating a precise cut in the middle.