JSFiddle - React, Tailwind, and code Playground

JavaScript

var ins = prompt('yjvth','');
  var num = [];
  var cash;
  num.push(ins);
  function res(){
		
	for (var i = 0; i < num.length; i++) {
	if (ins != num[i]){
	cash = ins;
	}else{break}
	}
	num.push(cash);
  }
  while (ins != "вывод"){
  ins = prompt('yjvth','');
  
  res();
  
  
    }
	alert(num);