reading-notes

View project on GitHub

what is a function ? its a group of series statement together that execute a task , specific task. rather than repeatin same statements , you can reuse the function.

  • to show at the top of the page in js : Before the closing </body> tag, you can see the link to the JavaScript file. The JavaScript file starts with a variable used to hold a new message, and is followed by a function called updateMessage() so this function will store , it will hold the statement, and Those statements are not run until the function is called.

  • now declaring the function ; you should creat afunction give it a name and write the statements that needed to achive its tasks inside the curly braces. the function will be simple its contain one statement , you should creat afunction give it a name and write the statements that needed to achive its tasks inside the curly braces so the function store the code to perform a specific task and when the script can ask the function to perform that task whenever needed. if you want to repeat the same task you can use the function to do it, instead of writing the same statement many times. its Consisting of:
  • function keyword (function)
  • function name (morning)
  • code block which is in the curly braces{} after you declaring the function , you can executed the statement that between curly . what if you want to specify the information to preform it in task? you can declare the function so you will ive it a parameters. parameters is act like variable insid the function.

gitting a single value out of a function: some functionreturn information to the code that called them , so when they execute the process they will return to the result.