<\/span><\/h2>\n\n\n\n\/\/ JavaScript Hello World Program\nconsole.log(\"Hello, World!\");\n<\/pre>\n\n\n\nOutput<\/strong><\/p>\n\n\n\nHello, World!\r<\/code><\/pre>\n\n\n\nThe console.log()<\/strong> method writes a message to the console. The console is used for testing and debugging purposes.<\/p>\n\n\n\n<\/span>JavaScript Hello World Program Using alert()<\/strong><\/span><\/h2>\n\n\n\n\/\/ JavaScript Hello World Program\nalert(\"Hello, World!\");\n<\/pre>\n\n\n\nOutput<\/strong><\/p>\n\n\n\nHello, World!\r<\/code><\/pre>\n\n\n\nAnother way to display Hello, World! Message is by using the alert()<\/strong> method. This alert() <\/strong>method displays an alert box with a message, which we pass as an argument to it.<\/p>\n\n\n\n<\/span>JavaScript Hello World Program Using Document<\/strong><\/span><\/h2>\n\n\n\n\/\/ JavaScript Hello World Program\ndocument.write(\"Hello, World!\");\n<\/pre>\n\n\n\nOutput<\/strong><\/p>\n\n\n\nHello, World!\r<\/code><\/pre>\n\n\n\nThe write()<\/strong> method writes a string of text to a document. The document.write()<\/strong> method is a part of Document API.<\/p>\n\n\n\n<\/span>Conclusion<\/strong><\/span><\/h2>\n\n\n\nI hope after going through this post, you understand how to write a hello world program in JavaScript<\/strong>.<\/p>\n\n\n\nIf you have any doubt regarding the program, feel free to ask us in the comment section. We will be delighted to help you.<\/p>\n","protected":false},"excerpt":{"rendered":"
In this post, we will learn how to write hello world program in JavaScript.<\/p>\n","protected":false},"author":2,"featured_media":4344,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[169,350],"tags":[349,347,348],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/www.codingbroz.com\/wp-content\/uploads\/2021\/10\/javascript-hello-world-program-codingbroz.png","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts\/4342"}],"collection":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/comments?post=4342"}],"version-history":[{"count":2,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts\/4342\/revisions"}],"predecessor-version":[{"id":4345,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts\/4342\/revisions\/4345"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/media\/4344"}],"wp:attachment":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/media?parent=4342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/categories?post=4342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/tags?post=4342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}