Hello coders!!๐
So, this is my Part-7 of JavaScript for Beginners!๐
Lemme remind you all, from Part-1 to Part-6 we had learned about:
- Printing statements, Variables in JS, Arithmetic Operators.
- Incrementing numbers, Decrementing numbers, Shortcuts :
(*=, /=)
, Add 1 to number,Escape sequences in strings.
- Concatenating strings with plus operator, Concatenating strings with plus equals operator, Constructing strings with variables, Activity!!.
- Find Length of string, Bracket Notations to find the characters of strings, Bracket Notations to find the last letter!
- Word Blanks!๐ณ (by using functions), Challenge!๐ฉโ๐ป `(On Functions)
- Store multiple things with Arrays!, Nested Arrays in JS!, Access array with data indexes!, Modify Array data with Indexes!, Access Multi-Dimensional arrays!!.
Manipulate Arrays with
push()
, Manipulate Arrays withpop()
, Manipulate arrays withshift()
, Manipulate arrays withunshift()
, Shopping list[]๐.Functions in JS!, Passing values in functions, Global scope๐ and Functions.๐, Local Scope and Functions, Global and Local Scopes!!๐๐.
So, this is all we had learned till now but in this blog we'll learn much more!!๐
Exited??
Topic:
Return values by Return statement!!๐
// Return function
function helloCoders(number) {
//created a function
return number - 9; //returning
}
console.log(helloCoders(59)); //output:59 - 9 = 50
Output:
50
Assignment for a return value!!๐ฑ
var complete = 0; // Global scope
function completed(number) {
//Created a function
return (number + 20) / 3;
}
console.log((complete = completed(100)));
Output:
40
2nd Example:
var changed = 0;
function change(num) {
return (num + 5) / 3;
}
console.log((changed = change(10)));
Output:
5
3rd Example:
var processed = 0;
function processArg(num) {
return (num + 3) / 5;
}
console.log((processed = processArg(7)));
Output:
2
Return statements (+, -)โ
Example of adding:
function myNum(num) {
return num + 800;
}
console.log(myNum(1000));
Output:
1800
Example of subtracting:
function subtractNum(num) {
return num - 30;
}
console.log(subtractNum(100));
Output:
70
So, that is it for today guys!! and also these were several examples for return statement!!๐
Hopefully you had learned something new!!
Motivation for Today: "When you have a dream you have got to grab and never let it go!!๐"
And I will see you all again in the nest blog till then take care and goodbyee!!โฅ