Student Activity

Student Activity (30-min)

Step-by-Step Procedure

  1. Install Node.js on Personal Laptops (15 min):

    • Follow the installation steps based on your operating system.

    • Verify using node -v and npm -v.

  2. Experiment with the REPL (15 min):

    • Open the terminal and type node to enter the REPL.

    • Try the following commands:

      javascript코드 복사// Calculate the square of a number
      let x = 5;
      x * x;
      
      // Concatenate two strings
      let firstName = 'Node';
      let lastName = 'JS';
      firstName + ' ' + lastName;
      
      // Create and call a function
      function greet(name) {
        return 'Hello, ' + name + '!';
      }
      greet('World');
    • Discuss findings and share outputs with peers.

Last updated