In JavaScript, we use functions everywhere. Imagine the an expression like x=a+6 or simmply one like 1+1 If you were to use these expressions often, it would save you time not having tp write the wole expression over and over. You would then equate them to a value; for example every time we need a value of a+6 we would just call x()

x() returns the value of a+6.

Luckily programming has been around for such a long time that we have in built functions. We donโ€™t have to reinvent wheels.

For Example, if I wanted to change part of the sentence My name is David which is store in a variable myName I would call the inbuilt function replace() and pass in the source string and the target string

copy the code and paste into app.js

Run the code by opening the index.html in the chrome browser, and navigate to developer tools to see the String James replace David.

In the Next Lesson we are going to start working seeing the changes directly in the weblage by adding interactivity into our index.html.

Back to Topics ๐Ÿ‘ˆ๐Ÿป

Next Lesson: Functions, Part 2 Click here๐Ÿ‘‰๐Ÿฝ

Take one minute to let us know what you want us to cover here Here .

Connect on twitter Twitter. share