Pergunta de entrevista da empresa Bionic.ai

Write a js/ts function that gets numbers between 1 and 1000 inclusive, that prints 'boom' every time the loop iterates a number that is divided by 7 with no remainder. After that, add another condition, every number that contains the number 7 (without using strings, only number and aritmetic actions). Then, stop the program for 1 seconds and then print the same 'boom'.

Resposta da entrevista

Sigiloso

6 de mai. de 2023

I used modulo operator, then I used division by zero and modulo to get the remainder digit every time. After that I used recursion to implement a "sleep" for 1 second. I didn't remeber how to solve it by promise.