Computer Science, asked by saisreemeghana2591, 6 months ago

Write a javascript code to accept any string from user count the length of the string and display in alert()

Answers

Answered by anindyaadhikari13
1

Correct Question:-

Write a javascript code to accept any string from user count the length of the string and display in alert()

Code:-

I am writing only the script.

Write this within script tag.

function myFunction()

{

var x=prompt("Please enter a String: ","");

alert(x.length);

}

Now, write the html code below,

<html>

<body>

<button onClick="myFunction()">Click Here</button>

</body>

</html>

Similar questions