Disneyland 1972 Love the old s
HomeAbout usContact us

Blog Update

Basic Coding Example with JavaScript

Basic Coding, Example, JavaScript


Basic Coding Example with JavaScript

If so, let's try to practice by writing the following program code. You can use a text editor like VScode or the like.

Lab Code:

1

2

3

4

5

6

7

8

9

10

11

12

13

Kode Lab:

<!DOCTYPEhtml>

<html>

<head>

<title>HelloWorldJavascript</title>

</head>

<body>

<script>

console.log("Saya belajar Javascript di Dicoding");

document.write("Hallo Dicoding");

</script>

</body>

</html>

When viewed in a text editor, it will look like this:

Please open the study2.html file by double clicking it. So the output is like this:

You see, how come the words "I'm learning JavaScript in Dicoding" don't appear. Don't worry! Because the console.log() command will only display messages into the JavaScript console. While document.write() function to write to HTML document.

Wow, we are familiar with the console.log() and document.write() functions. That's great.



Back to posts
Comments:

Post a comment