reading-notes

https://abrar189.github.io/reading-notes/

View project on GitHub

How JavaScript Makes Web Pages More Interactive.

  1. ACCESS CONTENT You can use JavaScript to select any element attribute, or text from an HTML page. For example: • Select the text inside all of the elements on a page • Select any elements that have a c 1 ass attribute with a value of note • Find out what was entered into a text input whose id attribute has a value of ema i 1

  2. MODIFY CONTENT You can use JavaScript to add elements, attributes, and text to the page, or remove them. For example: • Add a paragraph of text after the first element • Change the value of c 1 ass attributes to trigger new CSS rules for those elements • Change the size or position of an element

  3. PROGRAM RULES You can specify a set of steps for the browser to follow (like a recipe), which allows it to access or change the content of a page. For example: • A gallery script could check which image a user clicked on and display a larger version of that image. • A mortgage calculator could collect values from a form, perform a ca lculation, and display repayments. • An animation could check the dimensions of the browser window and move an image to the bottom of the viewable area (also known as the viewport)

  4. REACT TO EVENTS You can specify that a script should run when a specific event has occurred. For example, it could be run when: • A button is pressed • A link is clicked (or tapped) on • A cursor hovers over an element • Information is added to a form • An interval of time has passed • A web page has finished loading

EXPRESSIONS

  1. EXPRESSIONS THAT JUST ASSIGN A VALUE TO A VARIABLE example : var color = ‘beige’; The value of co 1 or is now beige.

  2. EXPRESSIONS THAT USE TWO OR MORE VALUES TO RETURN A SINGLE VALUE example : var area = 3 * 2 ;

The value of area is now 6.

OPERATORS

  • ASSIGNMENT OPERATORS
  • ARITHMETIC OPERATORS
  • STRING OPERATORS
  • COMPARISON OPERATORS
  • LOGICAL OPERATORS

FUNCTIONS

Functions let you group a series of statements together to perform a specific task. If different parts of a script repeat the same task, you can reuse the function (rather than repeating the same set of statements).

image

  • we can calling function by using name of function and giving the parameters that we want. image