Skip to content

Latest commit

 

History

History
65 lines (40 loc) · 3.08 KB

Read06a.md

File metadata and controls

65 lines (40 loc) · 3.08 KB

How to add Js to your HTML code :

as CSS there is difernet ways to link js to your code.. 1. The External Way (Linking): when we write the whole JS code in diferint file then link to it in the HTML code inside the tag <script> in the last body line before closing </body>

2. The Internal Way (Placing): when you write the JS code inside the same HTML code Under the Tag <script>

3. The Inline Way: when you write only the JS rules in the same element line, it mean that JS runs where its found..

so how to use JS and objects :

document.write("Heloo World!");

  • document: the first part witch represint the page and its always exist in wep pages

  • . : yes the dot! its the way to acsses the member of an abject

  • write() : its method that is familer for Document opject, and it allows to add new content to the element

  • ('the text here') : or parametres as know to all, so its basicly represnts the information that Method need to, and it sometimes it be inside parentheses..

What is statments ?

the step that computer folows to complete reading the <script>

always remember that JS is sensitive for cases so DOCUMENT means something difrent than document

What comment means :

always use comments to describe what hapinig in the code so you dont get lost in some point.. and in Js comments looks like // in the start of the line, you can also add multi line comments by add /*at the begin and */

WHAT IS A VARIABLE?

its kind of container for bits of information that JS needs, variables sometimes contain steps that you want script to rember like: var x = y*y +'this is the cube space' so evry time will mention X it will depends witch y is and use it had the cube space.. you can assign value to them like: (the varuble name) = (the value), and there is ruls to name variable like:

  1. The name must begin with a letter, dollar sign ($),or an underscore (_). It must not start with a number
  2. The name can contain letters, numbers, dollar sign ($), or an underscore (_)
  3. You cannot use keywords or reserved words
  4. All variables are case sensitive, so score and Score would be different variable names
  5. Use a name that describes the kind of information that the variable stores
  6. If your variable name is made up of more than one word, use a capital letter for the first letter of every word after the first word you can store diferint types of data in variables (String, Intger, or BOOLEAN)

Witch data JS support :

JavaScript distinguishes between numbers, strings, true or false and even values and the three data types is: 1. STRING DATA : it used when we worked on any kind of text, and it enclosed within singel or double quotes

2. NUMERIC DATA : witch always used with tasks such as determining the size of the screen, moving the position of an element on a page or tasks that involve counting or calculating sums

3. BOOLEAN DATA : witch simply only mention to tow answrs.. True OR False





Back To The Main Page