samedi 10 avril 2021

JavaScript testing: change Boolean value into an array of object

I'm doing a test in JavaScript. I'm asked to do the following:

function IsOffline (users, name) {
  // The function called "IsOffline" receives as an argument an array of objects called 'users' and a string called 'name'.
  // each object has a property 'name' which is a string and another called 'online' which is a boolean.
  // The function must return true if the user is offline, otherwise false.
  // ex:
  // var users = [
  // {
  // name: 'toni',
  // online: true
  //},
  // {
  // name: 'emi',
  // online: true
  //},
  // {
  // name: 'john',
  // online: false
  //}
  //];
  //
  // IsOffline (users, 'emi') return false

  // Your code here:
  

I'm a little lost and I don't know how to start. I appreciate any help.

Aucun commentaire:

Enregistrer un commentaire