Skip to content

Latest commit

 

History

History
84 lines (57 loc) · 2.13 KB

read4.md

File metadata and controls

84 lines (57 loc) · 2.13 KB

JavaScript:

This is a summary about Javascript

Def: Make your webpages more interactive, a script should be written based on your goals. 1-Access content: Selecting Items 2-Modify content: add text or remove it. 3-Program Rules: browser follow a set of steps to change the content of a page. 4-React to events: script run after an event.

In order to design your website within Javascript: 1-Define your goal 2-Design your script 3-Code each step

Two ways to use Javascript:

  • Opening and closing statements, the best is at the end of the body
  • Externally (recommended).

Naming your variables has rules:

  • Must begin with a letter, dollar sign ($), or an underscore (_).

  • Name can contain letters, numbers, dollar signs ($), or an underscore (_).

  • Keywords or reserved words cant be used.

  • Variables are case-sensitive.

  • Use a name that describes the kind of information that the variable stores.

  • capital letter for the first letter of every word if the variable more than one word.

Colors ['white'] is an example of an array

here some other examples

// one line comment

//its for showing a message 

/*

Datatypes:

-String: any text or set of characters " " or ' '

Numbers: any number in js (2, 4.6, 0.9)

Boolean: True or false Variables: store values into it Camel case: var firstName = "Omar " Operators: a symbol that does an action ; is not obligatory in js, it's later on it required

*/ 

//assignment operator  =

//arthmatic operators + - * / **(power) %  etc 

Console

  • Def: is important for developers to get to know what is happening
  • Something we can use
  • show the errors if we have "useful when there is a 1000 lines of code " Example var firstName = 'Omar'; console.log(x*z) console.log(firstName)

Concatination

  • console.log(X + firstName);
  • var fullName = firstName + X
  • console.log(fullName)

Comparison operartors

  • greater than >
  • less than
  • greater than or equal >=
  • less than or equal >=
  • not equal !=
  • == compare two values
  • === strictly equal , check everything datatype and value