hello world java script code example

Example 1: hello world javascript

// Output Hello World! in the console.
console.log("Hello World!");

Example 2: js hello world

let thisIstheSourceObjectforOurhelloWorldCode = {character1:"h",character2:"e",character3:"l",character4:"l",character5:"o",character6:"SPACE",character7:"w",character8:"o",character9:"r",character10:"l",character11:"d"}
let thisIsAnArrayContainingAlltheObjectKeyswhicheachrepresenttheindextoacharacter = Object.keys(thisIstheSourceObjectforOurhelloWorldCode)
let thisisanarraycontainingeachcharacterwegrabbed = []
let thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters = ""
for(let thisisanindexervaluewhereforeachtimeourlooprunsthiswillgoup = 0;thisisanindexervaluewhereforeachtimeourlooprunsthiswillgoup<thisIsAnArrayContainingAlltheObjectKeyswhicheachrepresenttheindextoacharacter.length;thisisanindexervaluewhereforeachtimeourlooprunsthiswillgoup = thisisanindexervaluewhereforeachtimeourlooprunsthiswillgoup + 1){
 let thisistheindexfortheactualvaluefortheobjectthatwegrabbedwiththekey = thisIsAnArrayContainingAlltheObjectKeyswhicheachrepresenttheindextoacharacter[thisisanindexervaluewhereforeachtimeourlooprunsthiswillgoup]
let thisistheactualvaluethatwegrabwiththeindex = thisIstheSourceObjectforOurhelloWorldCode[thisistheindexfortheactualvaluefortheobjectthatwegrabbedwiththekey]
thisisanarraycontainingeachcharacterwegrabbed.push(thisistheactualvaluethatwegrabwiththeindex)
}

for(let thisisanotherindexwherewegothrougheachofourcharacterstoprint = 0;thisisanotherindexwherewegothrougheachofourcharacterstoprint<thisisanarraycontainingeachcharacterwegrabbed.length;thisisanotherindexwherewegothrougheachofourcharacterstoprint = thisisanotherindexwherewegothrougheachofourcharacterstoprint + 1 ){
if(thisisanarraycontainingeachcharacterwegrabbed[thisisanotherindexwherewegothrougheachofourcharacterstoprint] == "h"){
thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters = thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters +"H"
}
if(thisisanarraycontainingeachcharacterwegrabbed[thisisanotherindexwherewegothrougheachofourcharacterstoprint] == "e"){
thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters = thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters +"e"
}
if(thisisanarraycontainingeachcharacterwegrabbed[thisisanotherindexwherewegothrougheachofourcharacterstoprint] == "l"){
thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters = thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters +"l"
}
if(thisisanarraycontainingeachcharacterwegrabbed[thisisanotherindexwherewegothrougheachofourcharacterstoprint] == "o"){
thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters = thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters +"o"
}
if(thisisanarraycontainingeachcharacterwegrabbed[thisisanotherindexwherewegothrougheachofourcharacterstoprint] == "w"){
thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters = thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters +"W"
}
if(thisisanarraycontainingeachcharacterwegrabbed[thisisanotherindexwherewegothrougheachofourcharacterstoprint] == "r"){
thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters = thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters +"r"
}
if(thisisanarraycontainingeachcharacterwegrabbed[thisisanotherindexwherewegothrougheachofourcharacterstoprint] == "d"){
thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters = thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters +"d"
}
if(thisisanarraycontainingeachcharacterwegrabbed[thisisanotherindexwherewegothrougheachofourcharacterstoprint] == "SPACE"){
thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters = thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters +" "
}
}
console.log(thisisthestringweconcatenatetogetheraftergrabbingandtransformingallourcharacters)

Example 3: javascript hello world

alert("Hello world");

Example 4: hello world in javascript

<script>
	alert("Hello World");  
</script>