Advertisement
CoineTre

Register Robot

Oct 9th, 2024 (edited)
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const robot = {
  2.   id: 1,
  3.   skill: null,
  4.   currentWorkPlace: cleaning,
  5. }
  6. const warehouse = {
  7.   aiStaff: [],
  8.   currentStatus: 100,
  9.   boxes: null,
  10. }
  11.  
  12.  
  13. function registerRobot(robot, warehouse) {
  14.  
  15.   warehouse.aiStaff.push(robot.id);
  16.   robot.currentWorkPlace = warehouse;
  17. }
  18.  
  19. /* When new robots get into the warehouse, a lot of routine work is done, first you need to make an entry in the inventory log, then change the robot settings so that he knows his place of work and much more. Let's start by automating the process of registering robots in the warehouse? Write the registerRobot function, which takes two objects robot and warehouse.
  20.  
  21. Scheme of objects:
  22.  
  23. robot {
  24.    id
  25.    skill
  26.    currentWorkPlace
  27. }
  28. warehouse {
  29.    aiStaff
  30.    currentStatus
  31.    boxes
  32. }
  33.  
  34. The function should add the id of the new robot to the array aiStaff, and for the robot object write a reference to the object warehouse to currentWorkPlace. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement