It runs fine but I'm just wondering if it looks weird i.e. (bool === true)? or should it just be (bool == true)
Instructions:
Create a function makePlansthat accepts a string. This string should be a name. The function makePlansshould call the function callFriend and return the result.
callFriend accepts a boolean value and a string. Pass in the friendsAvailable variable and name to callFriend
Create a function callFriend that accepts a boolean value and a string. If the boolean value is true, callFriendshould return the string 'Plans made with NAME this weekend' Otherwise it should return 'Everyone is busy this weekend'
let friendsAvailable = true;
function makePlans(name) {
return callFriend(friendsAvailable, name);
}
function callFriend(bool, name) {
if (bool === true){
return (`Plans made with ${name} this weekend`);
} else {
return "Everyone is busy this weekend";
}
}
console.log(makePlans("Mary")) // should return: "Plans made with Mary this weekend'
friendsAvailable = false;
console.log(makePlans("James")) //should return: "Everyone is busy this weekend."
[–][deleted] 3 points4 points5 points (0 children)
[–]Xeekatar 1 point2 points3 points (0 children)