Advertisement
didkoslawow

Untitled

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