Blog 7: From Beginner to Pro in JavaScript! πŸš€πŸ”₯

Blog 7: From Beginner to Pro in JavaScript! πŸš€πŸ”₯

Β·

2 min read

Hello coders!!πŸ‘‹

So, this is my Part-7 of JavaScript for Beginners!🍁

Lemme remind you all, from Part 1 to Part-6 we learned about:

  • Printing statements, Variables in JS, and Arithmetic Operators.

  • Incrementing numbers, Decrementing numbers, Shortcuts :(*=, /=), Add 1 to number, and Escape sequences in strings.

  • Concatenating strings with plus operator, Concatenating strings with plus equals operator, Constructing strings with variables, Activity!!.

  • Find the Length of the string, Bracket Notations to find the characters of strings, and 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 with pop(), Manipulate arrays with shift(), Manipulate arrays with unshift(), 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 have 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 statements!!πŸ˜‰

Hopefully, you have learned something new!!

Motivation for Today: "When you have a dream you have got to grab it and never let it go!!πŸ˜‰"

And I will see you all again in the next blog till then take care and goodbye!!β™₯

Β