var translation = {"apple": "яблоко", "grapes" : "виноград"} ; var word = "apple"; //Math.random() var text = "неверно"; var str = "яблоко"; //input.value if(str == translation[word]) text = "верно" ; alert(text);