what does javascript do code example

Example 1: what is javascript

Javascript is object oriented programing language.Javascript is both side clent side server side

Example 2: what is js

js is short for javascript

Your welcome :)

Example 3: what is javascript

// Function: creates a new paragraph and appends it to the bottom of the HTML body.

function createParagraph() {
  let para = document.createElement('p');
  para.textContent = 'You clicked the button!';
  document.body.appendChild(para);
}

/*
  1. Get references to all the buttons on the page in an array format.
  2. Loop through all the buttons and add a click event listener to each one.

  When any button is pressed, the createParagraph() function will be run.
*/

const buttons = document.querySelectorAll('button');

for (let i = 0; i < buttons.length ; i++) {
  buttons[i].addEventListener('click', createParagraph);
}

Example 4: what is javascript

JavaScript gives web pages interactive elements that engage a user.