Oke sekarang langsung ke script aja :
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display the array values after the split.
<button onclick="myFunction()">Try it
<p id="demo">
<script>
function myFunction() {
var str = "How are you doing today?";
var res = str.split(" ");
document.getElementById("demo").innerHTML = res[0];
}
</script>
</body>
</html>

0 komentar:
Post a Comment