Sad to see Path closing its private social network for good! No worries we can make a new one!! and we already have a new line-up users:
var hayatAlfahad = {
id: 1,
email: "hayat-fahad@gmail.com" ,
password:"dramaqueen" ,
friendsList: [],
age: 70,
banned: true
}
var falcor = {
id: 2,
email: "falcor@gmail.com" ,
password:"falcor1999" ,
friendsList: [],
age: 16
}
var ninnyMuggins = {
id: 3,
email: "ninny-muggins@hotmail.com" ,
password:"ninny788" ,
friendsList: [],
age: 20
}
var shiaLaBeouf = {
id: 4,
email: "shiala-b@icloud.com" ,
password:"JustDoIT2018" ,
friendsList: [],
age: 32,
banned: true
}
-
Sign up the users by creating an object
pathClone
then add all the lined-up users insideusers
property. -
Define a function
setAccountType
that takes a user and assign anaccountType
property to it. If the user is older than 16 years old then assign his/her account as a"normal account"
if not then it is a"kids account"
. -
Define a function
addFriend
that takes two arguments, the first argument name isfriend
which is a user object and the second argument name isuser
which is another user object, the function will take a user id from the friend object and add it to the other user’s friendList but don’t add a friends if they are banned instead print a messagebanned users cant have friends :)
-
Add
shiaLaBeouf
tohayatAlfahads
friendsList -
Add
ninnyMuggins
andfalcor
toshiaLaBeouf
's friendsList -
Define a function
countFriends
that takes one argument as auser
object and return the number of the user's friends. -
Return shiaLaBeouf frinds count
-
Define a function
removeFriend
that takes two arguments the first argumentfriendId
which is a user id and the second argument isuser
another user object, the function will look for the friendId inside the other user’s friendList then remove the friend if there is no match return a funny message! -
Remove
ninnyMuggins
fromshiaLaBeouf
's friends list -
Remove
hayatAlfahads
fromshiaLaBeouf
's friends list