JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

JavaScript

var translatedWord = "";
currentCharacter = "猫";
translateRequestURL = 'https://translate.googleapis.com/translate_a/single?client=gtx&sl=zh-CN&tl=en&dt=t&q=' + currentCharacter;
$.ajax(translateRequestURL).done(function someFunction (data) {
	translatedWord = data[0][0][0]; //this is what I need
  alert('This works '+translatedWord); //this works
  return translatedWord;
});
someFunction();
alert('this does not but I need it to '+translatedWord); //this doesn't work