JavaScript is a scripting or programming language that allows you to implement complex features on web pages – every time a web page does more than just sit there and display static information for you to look at – displaying timely content updates, interactive maps, etc. – you can bet that JavaScript is probably involved. A function is a sequence of statements that performs a specific operation. Functions are used to break down a program into smaller, reusable pieces. In javascript, a function is defined using the keyword function and is immediately followed by the function name and a pair of parenthesis. Inside the parenthesis, you can define any number of arguments that are passed to the function when it is called. If we want to use the function anywhere within that program, we simply need to mention the function name followed by a semicolon and the syntax is: function_name();. The JavaScript code within the function gets executed when that function is (called). The basic idea of a function is to reduce the number of repeated code. In JS, the return keyword returns a value from a task The task will return the value immediately when the keyword is encountered. This means that the task will not execute any more statements beyond the return keyword, and any local variables created in the task will be discarded.
Hi Ivan,
I like how you defined Javascript as an interactive tool that is needed for websites. Also, the function is a sequence that can be break down into smaller pieces and be reused is a perfect way to describe what a function is. I had trouble understanding what the keyword returned until I read your post. It made things clear about what the return keyword is and how helpful it is when coding.
Hello Ivan,
You mentioned that Javascript is a scripting or programming language. While reading information for my previous posts, I came across a paragraph explaining the difference between the two. It stated that a scripting language is used to assist a programming language. This ultimately makes coding more efficient and easier for its users. This makes sense because that is what Javascript is known for, making it easier and less time-consuming.