to describe and define elements within a document. JavaScript is a programming language. Programming languages are used to communicate instructions to a machine. Programming languages can be used to control the behavior of a machine and to express algorithms.
developer tools. This console is useful for the following reasons: • Errors and warnings that occur on a web page are logged into the console. • JavaScript commands for interacting with a web page can be executed in the console. To access, press CTRL + SHIFT + J
statement, which only runs if the condition enclosed in parentheses () is truthy. else You can extend an if statement with an else statement, which adds another block to run when the if conditional doesn’t pass. else if You can also extend an if statement with an else if statement, which adds another conditional with its own block.
JavaScript. A function is a JavaScript procedure—a set of statements that performs a task or calculates a value. To use a function, you must define it somewhere in the scope from which you wish to call it -Mozilla Developer Network
statement) consists of the function keyword, followed by: • The name of the function. • A list of parameters to the function, enclosed in parentheses and separated by commas.
simply names the function and specifies what to do when the function is called. Calling the function actually performs the specified actions with the indicated parameters. For example, if you define the function square, you could call it as follows: