JSFiddle - React, Tailwind, and code Playground JavaScript var id = 'foo'; var xfoo = "What we are looking for"; alert(eval('x'+id));