JavaScript Built-in Methods
What are built-in methods?
A JavaScript method is a property containing a function definition. In other words, when the data stored on an object is a function we call that a method.
To differenciate between properties and methods, we can think of it this way: A property is what an object has, while a method is what an object does.
Since JavaScript methods are actions that can be performed on objects, we first need to have objects to start with. There are several objects built into JavaScript which we can use.
How to access object methods?
We call, or use, methods by appending an instance with:
- a period (the dot operator)
- the name of the method
- opening and closing parentheses
You access an object method with the following syntax:
objectName.methodName()
The methodName property will execute (as a function) when it is invoked with ().
If you access the methodName property, without (), it will return the function definition instead of executing an action.
Using docs
I cannot stress enough just how important being familiar with the official documentation can be. You do not need to memorize everything, but you should know where or how to find something you need.
That is why using documentation is part of the daily lives of developers. Developers use documentation as a reference tool. It describes JavaScript’s keywords, methods, and syntax.
Take a moment to look at the javascript documentation by MDN Web Docs and play around with the links. There is a ton of very useful information about javascript in theses pages.
It does not matter if you don't understand everything right away. Everybody goes through different learning paths ¡Just keep practicing!
- Arts
- Business
- Computers
- Games
- Health
- Home
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World