Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Online HTML Editor

<html>
<head>
</head>
<body>
<p ID = "p1" > </p> 
<p ID = "p2" > </p>
<p ID = "p3" > </p>
<script>
    var numApples;
    numApples = 1;
    
    document.getElementById("p1").innerHTML = numApples;
    
</script>

<script>
    Book1 = {title: "Ur mum", author: "ur mum"};
    document.write(Object.values(Book1));
    document.getElementById("p2").innerHTML = Object.values(Book1);

    
</script>

<script>
    var num1= 10 > 2;
    var num2 = 2 < 3,
    num3 = num1&&num2
    document.getElementById("p3").innerHTML = num3
        
</script>

<script>
    word1= "I";
    word2= "gen";
    phrase1= word1.concat(word2);
    document.write(phrase1);
    
    
</script>

<script>
    word1 = "green"
    letter = word1.charAt(4);
    document.write(letter);
    
</script>

<script>
    var things = [];
    things[3432] = "fire";
    things[12] = "water";
    things[3] = "land";
    things.push("wind");
    things.push("sand");
    document.write(things.indexOf("sand"));
    
</script>

<script>
    var number = 5;
        if (number ==5){
                newString = "the number is 5";
        }else if (number > 5){
                newString = "number is greater than 5";
        }else{
                newString = "number is less than 5";
                
        }
        document.write(newString)
</script>

<script>
    
    var day = "Monday";
    switch(day){
        case "Monday":
            message = "It's Monday!";
            break;
        case "Tuesday":
            message = "It's Tuesday!";
            break;
            default:
            message = "It isn't Monday or Tuesday";
        
    }
    
    
</script>

        
</body>
</html>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.