JSFiddle - React, Tailwind, and code Playground
HTML
<h2>How to get a value from an input box and use that value within an object literal?</h2>
<a href="http://stackoverflow.com/questions/13081502/using-variable-within-javascript-object-literal">so question</a><br/>
<script>
function doStuff(){
var realIncome = document.getElementById("income").value;
var objLit= { realIncome: realIncome, desiredIncome: realIncome * 4 };
console.log(objLit);
document.getElementById("out").innerText = objLit.realIncome + " " + objLit.desiredIncome;
}
</script>
Big Number <input id="income" name="income" type="number" placeholder="please enter your desired income">
<button name="calculate" onclick="doStuff()">click me </button>
<h2> Your income <span id="out"></span></h2>