javascript node js tutorial code example

Example 1: writefile in node js

// append_file.js

const fs = require('fs');

// add a line to a lyric file, using appendFile
fs.appendFile('empirestate.txt', '\nRight there up on Broadway', (err) => {
    if (err) throw err;
    console.log('The lyrics were updated!');
});

Example 2: node.js

When you install Node.js, you can do these things:
Make web servers
Run JavaScript without an HTML file
...and more!

Example 3: javascript tutorial

<html>
   <body>   
      <script language = "javascript" type = "text/javascript">
         <!--
            document.write("Hello World!")
         //-->
      </script>      
   </body>
</html>

Tags:

Html Example