+ 4
š„š
³š
“š
šš
·š
øš
š
½š
°š
½š
³š
°š
½ š
¼š
øšš
·šš
°š„
First issue js variable is not accessible in html like that. Also your calling function in html doesn't have parameter.
Second issue just call function in html onclick event.
Third issue querySelector should get value using # because sqrt is a id.
Also you should get value by using .value with querySelector.
string "js" is not coming because of comma (,) which is not work in alert. this only work in console.log
Suggestions:- no need to write js code in html instead you can all do in JS.
Do this:
function sqrt() {
let square = document.querySelector("#sqrt").value;
let sqrt1 = square * square;
alert('Square of ' + square + ' is: ' + sqrt1)
}
https://code.sololearn.com/WDNXpYyiU6wm/?ref=app