TRUST THE JOURNEY (THE PROCESS)
Chinenye Juliet
Posted on July 10, 2020
Learning how to program or better put to code has not been a smooth drive path on my side's story.What could be the reason,the next door neighbour might seem curious about.On this trench is a case of clarity and time adapting.Big thanks to mechanism of human processing and adaptation quality that have aided the coping and better fixation.
Yes let me continue,this quest made me to sign up for She Code Africa Mentorship Program Cohort 2, JavaScript track and got accepted.She Code Africa is an Establishment whose mission is to have an Africa where women are equally represented across all roles in technology.
BASIC PROGRAMMING CONCEPT(JAVASCRIPT)
JavaScript is a programming language of the web. The html pages uses it for interactivity. This programming language has evolved that is not just used on frontend aspect,it is also used on the backend aspect(nodejs).
PROGRAMMING: Programming is the act of creating Programs. Programs are set of instructions (inputs) given to the computer to process for a particular result or results (output). The processing is done by the processor. These Programs are achieved through what we call code, writing code requires understanding the rudiments of the language.
VARIABLE:Every Programming language has its own way of declaring variable, JavaScript uses the keyword var,let and const to declare variable. Variable can simply be seen as a box for storing values or data. You write var and then the name you wish to call the variable. Example:
From our example any where we write num we ask the box(container) to look for the variable num and get its value for us.
From the above code snippet if you check your browser console you will see that we have 4 as the value of sum. This is because the value of num which is 2 is added to num value 2.
OPERATORS:We have different types of operators in JavaScript.They are as follows
*Arithmetic Operators:The arithmetic operators include:
- +(addition operator)
- -(substraction operator)
- *(multiplication operator)
- /(division operator)
- %(modulus (aka remainder)operator)
*Comparism Operator:for comparing between variables and values.it includes:
- < (less than operator)
- > (greater than operator)
- <= (less than or equal to operator)
- >= (greater than or equal to operator) *Assignment Operator: Assignment operator is used to assign value to variable. It is represented as = sign(normal equal to sign in math). *Compound Assignment:This is a combination of the arithmetic operator and the assignment operator.it include: +=, *=, -=, /=
*Equality Operator:The equality is used to show that variables are of the same value or type. We have
I.Loose Equality Operator(==):This is used to check if variables contain same value but not same type. Example
The above code will return true because num1 contains string"22" and num2 has it's value as number 22.
II. Strict Equality Operator(===):This compares value for same value and data type.Example:
The above will show "not same" on the console. This is because num1 and num2 variable s has different data types.
If you copy and paste the above code snippet on your browser console and run by clicking enter. Then if you type the following built-in function typeof(num1) and typeof(num2),num1 will return string while num2 will return number.
*Logical Operator: logical operators are used for combining variable comparism.
- And(&&):This is represented as double ampersand sign, it is used to make decision when both comparing terms are true. That is certifies the condition.
- Or(||):This is represented as double parallel lines. It returns true when either of the terms being compared returns true.
EXPRESSION: An expression is a set of variable which has operands and operators which after the computer runs resolves to a value.
Operands can be any of the JavaScript data types.
DATA TYPES
In JavaScript the following data types exist.
- String: This is when a variable has its value assigned to set of letters. This is enclosed in a quotation mark. Example
The quotation mark can be single quote or double quote.
In a place where another quotation is to be added to the string a slash / is added in front of the quote.
Example
- Number: Is when a variable has it's value assigned to it is a number. var justNum =5;
*Boolean: I see booleans as truthy and falsy values. When a variable is assigned true or false value.
var girl = true;
var boy = false;
- Undefined: A variable without a value,has a value undefined. The type is undefined.
- Null:null means nothing,we can assign a variable to null, or empty a variable that has a value to nothing using null. var student = null; var girls ="Helen"; girls = null; From the above the variable girl is emptied by reassigning it to null. There are other data types which are called complex data types: it include
- Array
- Object
- Function
Other basic Programming concept in JavaScript include
*Knowing the syntax of the language.
*Understanding scope.
*Understanding conditional statements for decision making.
*Be able to create functions which are reusable lines of code which does a particular action once called on.
*Understanding loop which are used to repeat a set of actions until a certain condition is false.
All these basics should be gotten before diving deep.
These concepts I have tried to digest to enable better move going forward.
Posted on July 10, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 24, 2024
November 22, 2024