Adding a variable to store the sensor output in HTML

What is the way for adding a variable to store the sensor output in HTML ?
Thanks !

OK the question is not clear.
HTML is used to render and show stuff not store data.

You store data in JavaScript.
var x=0;
At the top and x will be accessible from everywhere.
Or if you want to store a collection of values.
var data =[];
And use the following to add data
data.push(21);
To append 21 to the collection.
If you still want to store data in HTML use a input type hidden but it’s not the best way

HTML is a markup language, it cannot be used to store a variable.
Javascript is a scripting language, you can always store data in variable using JS. Thanks