running the basic Javascript tests in DOM (in-memory)

by Afzaal Ahmad Zeeshan

JavaScript

var _p = document.createElement("p");
var _input = document.createElement("input");
var _button = document.createElement("button");
console.log(`_p: ${_p.innerText}`);
console.log(`updating the value in input to 'hi'...`);
_input.value = 'hi';

_button.onclick = function handleClick() {
	console.log(`clicked the button, changing the value to ${_input.value}`);
	_p.innerText = _input.value;
}

_button.click();

console.log(`_p: ${_p.innerText}`);