RUVIDEO
Поделитесь видео 🙏

40. Javascript Functions and methods - Full stack web development Course

In this FullStackWebDevelopment tutorial series video, We will learn about #javascript #functions and #return Statement.

A JavaScript function is a block of code designed to perform a particular task. Function increases code reusability and decreases code length also makes it easier to debug.

A JavaScript function is defined with the function keyword, followed by a name, followed by parentheses (). Function names can contain letters, digits, underscores, and dollar signs. The parentheses may include parameter names separated by commas:(parameter1, parameter2, ...) The code to be executed, by the function, is placed inside curly brackets: {}

Syntax:
function name(parameter1, parameter2, parameter3)
{ // code to be executed }

Example:
function myFunction(a, a)
{return a * b; // The function returns the product of p1 and p2}

The code inside a function is executed when something calls or invokes a function i.e. when it is called from a javascript code, an event occurs(such as when a button is clicked) or sometimes self invoked.

-- return Statement:
var x = product(4, 3); // Function is called,
function product(a, b)
{ return a * b; //returns the product of a and b, return value will end up in x}

If a function is invoked from a statement, JavaScript will return to execute the code after the invoking statement. When JavaScript reaches a return statement, the function will stop executing.

-- Function calling:
With the call() method, we can write a method that can be used on different objects. It is a predefined JavaScript method used to invoke (call) a method with an owner object as an argument (parameter). This is helpful when an object wants to use a method belonging to another object. Example:
var person = {
fullName: function() {
return this.firstName + " " + this.lastName;
}}
var person1 = {
firstName:"Dane",
lastName: "Price"
}
person.fullName.call(person1); // Will return "Dane Price"

-- Function parameter: Function parameters are the names listed in the function definition whereas arguments are the real values passed to (and received by) the function.
Syntax: function functionName(parameter1, parameter2, parameter3) {
// code to be executed
}

JavaScript function definitions do not specify data types for parameters, do not perform type checking on the passed arguments and also do not check the number of arguments received.

-- Function as object: In JavaScript, functions are objects. We can work with functions as if they were objects. For example, we can assign functions to variables, to array elements, and to other objects. They can also be passed around as arguments to other functions or be returned from those functions. JavaScript functions are a special type of objects, called function objects. A function object includes a string which holds the actual code -- the function body -- of the function. The code is literally just a string.

Example:
function Book (type, author) {
this.type = type;
this.author = author;
this.getDetails = function () {
return this.type + " written by " + this.author;
}}
var book = new Book("Fiction", "Peter King");
alert(book.getDetails()); // Fiction written by Peter King
Here we are creating a new function with a custom constructor function.

----------------------------

Week 1 : Day 7
Section 5 : Learning to Code With Javascript
Tutorial 40: Javascript Functions and return Statement

----------------------------
Do subscribe and hit Bell Icon
----------------------------

Follow us in social media handles for opportunities and code related support.

Instagram: https://www.instagram.com/wb.web/
Facebook: https://www.facebook.com/wbweb/
Twitter: https://twitter.com/wbweb_in/
LinkedIn: https://www.linkedin.com/company/wbweb/

----------------------------

Got a question on the topic? Please share it in the comment section below and our experts will answer it for you.

For more information, please write back to us at [email protected] or call us at IND: 7077568998

After completing the course, write to [email protected] for internship or freelancing opportunities.

For consultation or partnership related queries drop a mail to [email protected].

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «40. Javascript Functions and methods - Full stack web development Course», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.