Home Innovation JavaScript Essentials You Must Know To Being A Pro Dev!

JavaScript Essentials You Must Know To Being A Pro Dev!

41
0

Just jumping in and learning something like React is a bad idea. I say you need to know core JavaScript first.

In any complex field, skills and knowledge tends to build on top of other skills and knowledge. For example mathematics. No teacher would attempt to teach quadratic equations prior to their students first having mastered addition, multiplication, subtraction and division. Saying, “Ah, but you can learn those things as you learn quadratic equations” would seem like madness. Advance maths clearly needs a foundation in basic maths first.

It’s the same when learning to code.

Frameworks like React / Angular / Vue are built in JavaScript, and watching tutorials for these or build a small live project will assume knowledge of JavaScript to a level. Knowing the difference between a function and a class is a prerequisite for knowing the difference between a functional component and class component in React, for example. If you don’t understand scope and closures, you’re going to run into issues when building components.

It may even be possible to just learn how to do basic stuff in React without learning core JavaScript first, but I guarantee you’ll come apart in any JavaScript interview if you do this. Even for React based roles, questions about core JavaScript knowledge are always key in any JavaScript interview. You are gonna fail hard if you don’t know this stuff.

So here are the list of core JavaScript topics that one must know, with a brief description of each with examples:

Variables and data types

A variable is the smallest building block in any programming language. They allow you to store values which may be unknown at the time you write your code. Think of a simple program to add two numbers together. If you couldn’t use variables, say a + b, you could only have a program which added the same numbers together each time!

Data types define what sort of data is held in a variable. Different types of data have different capabilities. Eg numbers can be multiplied, text (strings) cannot.

// declaring single variable

var x = 5; //can store an integer

var name = ‘string’; //can also store a string

// declaring multiple variables

var name, title, num;// initializng variables

var name = "Michael";

name = "Chilaka";

title = "Frontend Developer";

 

Basic maths operations

I think this is pretty obvious, we know JavaScript only has one data type for numbers, both integers and decimals — you guessed it, Number. This means that whatever type of numbers you are dealing with in JavaScript, you handle them in exactly the same way. No detail needed!

var myInt = 5;

var myFloat = 6.667;

myInt;

myFloat;

Basic string operations

Strings are basically text. You need to know how to chop up strings, search for string with string etc.

<p id="demo"></p>

var txt = "Sales Ruby Limited";

document.getElementById("demo").innerHTML = txt.length;

 

Expressions

Expressions are basically anything that can resolve to a value / be used anywhere a value can be used. Like there are any of code that can be evaluated to a value; and such expressions can be arithmetic, string, logical, comparison, assignment, bitwise, conditional, comma, unary, relational, primary etc.

1 / 2 //arithmetic

i * 2 //arithmetic

‘a’ + ‘string’ //string

true //primary

false //primary

undefined //primary

a && b //logical

a || b //logical

!a //logical

 

Boolean logic and flow control

Booleans are a data type which only allow two values: true or false. They are important because they allow for the flow of your program to differ depending on conditions placed on the value of variables. For example:

if (salesRuby < 40) {

employeesNumberFailureNotification();

} else {

employeesNumberSuccessNotification();

}

You can’t really do much in programming without the code being able to take different paths based on values. You’d just do the same thing every time!

Functions

Functions are the most basic way that programming languages make code reusable. Functions are a little like ‘subprograms’ within your main program. You can write a function once then reuse that functionality anywhere in the code just by calling the function.

function showMessage() {

alert(“Sales Ruby, The No 1 Sales Organization in Africa”);

}

showMessage();

 

Objects

Objects are a composite data type which can be used to model real world entities that the more basic data types cannot. They can used to store both properties (variables) and functionality (functions). Defining an object can be a bit like defining your own custom complex datatype which can be reused again and again within your code.

let salesRuby = {

name: “Chilaka Michael Obinna”,

employed: “September 2019”

position: “Frontend Developer”,

location: “Ikeja, Lagos”,

established: 2016,

displayInfo: function() {

console.log(`${salesRuby.name} employed ${salesRuby.employed}       to Sales Ruby which is located at ${salesRuby.location} and was        established ${salesRuby.established}.         He is a ${salesRuby.position} .`);

}

}

salesRuby.displayInfo();

 

Scope

Put simply, scope defines which variables can be used where within your code. Although scope exists as a concept in all programming languages, I find that the rules for it in JavaScript are more complex than in most languages. Easy to get caught out on this one if you don’t study it!

var salesRuby = ‘Johnson Inya’;

function localScopeExample() {

// LOCAL SCOPE

console.log(salesRuby);

}

// GLOBAL SCOPE

console.log(salesRuby);

 

Closures

A close cousin of both scope and functions, and does not exist in all languages, which means JavaScript interviewers just love to ask about it! It’s basically rules on how variables can still be in scope when in a function returned by another function, even though based on the normal rules of scope they wouldn’t be.

function salesHead() {

var name = “Iyanu Fatoba”;

function displaySalesHead() {

var name = “Henry Okeke”;

console.log(name)

}

displaySalesHead();

}

salesHead();

 

Arrays

These are basically lists, very useful.

let salesRubyTechEmployee = [“Hannah”, “Johnson”, “Peter”, “Chilaka”];

console.log(salesRubyTechEmployee);

 

Modules

A fairly new addition to the JavaScript language, but I’d consider them key. A module allows you to create a mini library with functionality which can then be imported into other code and used. A module is just a file. One script is one module. As simple as that. Modules can load each other and use special directives export and import to interchange functionality, call functions of one module from another one.

Most 3rd party libraries are implemented as modules these days.

// 📁 sales.js

export function salesRuby(staffs) {

alert(`These are Sales Ruby ${staffs}.`);

}

// 📁 main.js

import {sales} from “./sales.js”;

alert(sales);

sales(‘Bunmi Jembola, CEO Sales Ruby’);

 

So there you have it. I know these descriptions were short, but I cannot teach you core JavaScript except you practice it everyday and boost up your knowledge. Knowledge is nothing without putting it into practice, and that’s the key to your learning.

If you want know to optimally drive your sales revenue, process etc then I know that the Sales Ruby Sequentia got your back if you are sales manager, head of sales etc then you have no problem of checking your sales people. We have built and deployed a robust platform that handles the authenticity and scalability of automation though we are open to critics, that will make us knowing where never got it well. https://sequentia.salesruby.com/