JSFiddle - React, Tailwind, and code Playground
by velmurugansp
HTML
Speed
<input type="text" />
time
<input type="text" />
<button>
Calculate
</button>
JavaScript
// A train running at the speed of 60 km/hr crosses a pole in 9 seconds. What is the length of the train?
// Length of the train = (Speed x Time).
var length;
var question;
var answer;
var speed = 60;
var time = 6;
var speedInMeterPerSec = speed * 5 / 18;
length = speedInMeterPerSec * time;
question = " A train running at the speed of " + speed + " km/hr crosses a pole in " + time + " seconds. What is the length of the train? ";
answer = length + " metres";
console.log(question);
console.log(answer);