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!!♥