How i can make this function in javascript

welcome to shbcf.ru