JSFiddle - React, Tailwind, and code Playground
by LeeMellinger
JavaScript
document.write("test1 <br>")
document.write("test2 <br>")
var firstName = "Lee";
var lastName = "Mellinger";
document.write(firstName + "." + lastName + "<br>")
var initials = firstName.substring(0, 1) + lastName.substring(0, 1);
document.write(initials + "<br>")
document.write((5 > 10) ? "5 > 10" : "5 < 10" + "<br>" );
document.write("-----------------<br>");
var x = 5;
var y = 5;
if (x > y)
{
document.write("x > y" + "<br>" );
}
else if (x < y)
{
document.write("x < y" + "<br>" );
}
else
{
document.write("x = y" + "<br>" );
}
document.write("-----------------<br>");
x = 2;
switch(x)
{
case 1:
document.write(1)
break;
case 2:
document.write(2)
break;
case 3:
document.write(3)
break;
default:
document.write(0)
break;
}
document.write("<br> ----------------- <br>");