georgiev955

task 5

Sep 19th, 2023
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function createAssemblyLine() {
  2.   return {
  3.     hasClima(myCar) {
  4.         myCar.temp = 21;
  5.         myCar.tempSettings = 21;
  6.         myCar.adjustTemp = () => {
  7.             if(myCar.temp < myCar.tempSettings) {
  8.                 myCar.temp++;
  9.             } else if (myCar.temp > myCar.tempSettings) {
  10.                 myCar.temp--;
  11.             }
  12.         };
  13.     },
  14.     hasAudio(myCar) {
  15.         myCar.currentTrack = null;
  16.         myCar.nowPlaying = () => {
  17.             if(myCar.currentTrack !== null) {
  18.                 console.log(`Now playing '${myCar.currentTrack.name}' by ${myCar.currentTrack.artist}`);
  19.             }
  20.         };
  21.     },
  22.     hasParktronic(myCar) {
  23.         myCar.checkDistance = function(distance) {
  24.             if (distance < 0.1) {
  25.                 console.log("Beep! Beep! Beep!");
  26.             } else if (distance >= 0.1 && distance < 0.25) {
  27.                 console.log("Beep! Beep!");
  28.             } else if (distance >= 0.25 && distance < 0.5) {
  29.                 console.log("Beep!");
  30.             } else {
  31.                 console.log("");
  32.             }
  33.         };
  34.     },
  35.   };
  36. }
Advertisement
Add Comment
Please, Sign In to add comment