3 examples of 'print hello world in javascript' in JavaScript

Every line of 'print hello world in javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
1function hello(name) {
2 alert("Hello "+ name);
3}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

1export function sayHello(name) {
2 return 'Hello ' + name;
3}
32function hello() {
33
34 var dots = document.getElementById("dots");
35
36 // After "app" content has loaded, no need to continue
37 if (!dots) {
38 return;
39 }
40
41 dots.innerHTML = direction ? `${dots.innerHTML}.` : dots.innerHTML.slice(0, -1);
42
43 // Change direction
44 var len = dots.innerHTML.length;
45 if (len === 6) {
46 direction = false;
47 } else if (len === 1) {
48 direction = true;
49 }
50
51 setTimeout(hello, 400);
52}

Related snippets