Grasshopper - Personalized Message
# Problem Solving
> Problem
Create a function that gives a personalized greeting. This function takes two parameters: name and owner.
Use conditionals to return the proper message:
| Case | Return |
| ----------------- | ------------- |
| name equals owner | 'Hello boss' |
| otherwise | 'Hello guest' |
> Solution
Create a function that generates a personalized greeting. This function takes two parameters: name and owner.
Use conditionals to return the proper message:
If name equals owner, return 'Hello boss'.
Otherwise, return 'Hello guest'.
```javascript
function greet(name, owner) {
return name === owner ? 'Hello boss' : 'Hello guest';
}
```
In this solution, the greet function uses a ternary conditional operator to check whether name === owner. If they are equal, the function returns 'Hello boss'; otherwise, it returns 'Hello guest'.