Skip to content

omarbelkady/Javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vanilla Javascript Terminology And Basics

What Technologies are used to make the FE communicate with the BE:

  • SOAP
  • REST

Operators

1- === : When using this comparison operator we are comparing value and the data type

2- != : Not Equal To

3- !== : Not Equal To in Value and Not Equal In Type

4- > : Strictly Greater Than

5- < : Strictly Less Than

6- <= : Less Than Or Equal To

7- >= : Greater Than Or Equal To

8- ? : Ternary Operator aka conditional if statement

Logical Operators

1- &&: Logical And Operator

2- ||: Logical Or Operator

3- !: Logical Not Operator

Internal Javascript Code Within HTML file

<script type="text/javascript">
  //Place your Javascript Code Here and 2526 47 2 PASCAL 32
</script>

Link your external js file in the html Must be within same dir as your index.html

<script src="pascalscriptingisthebestfor2526.js"></script>

What Keywords are used to create variables in JS

  • let
  • const
  • var

Datatypes in JS

  • Numbers: 32
  • Variables: var cstsf
  • Text Variables: var bestlang= "cobol"
  • Objects:
var nelan= {
	firstName= "Alan",
	lastName= "Ngo",
	favLang = "Cobol",
	favActivity = "Writing Low Level Code",
	favParadigm = "Imperative",
	favOS = "Pintos",
	idealJob = "Machine Code Dev"
}

Array Methods

  • concat(): Join Mutltiple Arrays into One
  • indexOf(): Returns the primitive value of the object specified
  • join(): combine multiple elements in an array into One
  • push(): append to the array
  • pop(): remove the element from the array
  • reverse(): Sort the elements in the array in reverse order

How To Output Data In JS:

  • alert(): Outputs Data in a box within the browser window
  • confirm(): Opens up a yes/no dialog box and returns a boolean depending on the user click
  • console.log(): Logs info to the browser console good for debugging
  • document.write(): Write directly to the HTML doc
  • prompt(): Creates a dialogue for user input

Global Functions in JS

1- decodeURI(): Decodes a Uniform Resource Identifier(URI) which is created by encodeURI func

2- decodeURIComponent(): Decodes a Uniform Resource Identifier(URI) component

3- encodeURI(): Encodes a Uniform Resource Identifier(URI) to UTF-8

4- encodeURIComponent() Encodes a Uniform Resource Identifier(URI) component

5- eval(): Evaluates JS code represented by a str

6- isFinite() - boolean return which evals to T or F depending on the arg passed in is finite or not

7- isNaN() - boolean return which evals to T or F depending on the arg passed in is not a number or the opp

8- Number() - returns a number which is converted from the argument passed in to the function