I took befor about HTML & CSS , So to be clear I want to quickly explain about them:
- HTML elements are add to the content of a page to describe its struture .An element consists of the openung and closing tags , plus its content.
Example:
<p class = "fruit "> peach </p> - CSS uses rules to indicate how the contents of one or more elements should be displayed in the browser . each rule has a selector and a declaration block.
Example:
.fruit { color : pink ;}
Desighning a script steps:
Each individual task may be broken down into a sequence of steps . when you are ready to code the script , these steps can then be translated into individual lines of code.
Javascript has expression :
- Expression that just assign a value to a variable .
ex: var color=’beige’;
- expressions that use two or more values to return a single value. ex: var area 3*2;
How you declaring a function in javascript?
A JavaScript function is defined with the function keyword, followed by a name, followed by parentheses (). Function names can contain letters, digits, underscores, and dollar signs (same rules as variables). The parentheses may include parameter names separated by commas: (parameter1, parameter2….)
## Example :
#### First: You declare a function using the function keyword.
#### Second: You give the function a name (sometimes called an identifier) followed by parantheses.
#### Third: the statments that perform the task sit in a code block.(They are inside curly braces)
NOTE (If different parts of a script need to perform the same task , you do not need to repeat the same statments multiple times - you use a functionto do it(and reuse the same code)).
## Calling a function if you declared the function you can execute all of statments between its curly braces with just one line of code. _To run the code in the function you use the function name followed by parentheses.
Getting single value out of a function
Getting multiple values out of a function
