I think we all know JavaScript, yes; if you know about Objects, Functions, Arrays, Boolean, Numbers, then you know JavaScript!
We know that an object allow us to store related pieces of information in a single central location
let object = {
/*
this is a single central location
*/
}
and to store an object we declare a variable and set it equal to an opening and closing parenthesis.
//object is the variable that stores our Object
let object = {
// these are related pieces of information
name: 'Agbeze Obinna',
age: 25,
location: 'Nigeria'
}
We also know about object name, properties and property values. And we access those property values like so..
// the object name followed by a dot, followed by the property
// whose value you are trying to get
object.name
object.age
We also know that a function is a sub program that allows us to do some interesting things multiple times or letβs say listen for a button click. Every single thing that happens on the screen (user-interface) is the work of a function, when you view a web page, behind the scene multiple functions has executed. We can also store a function in a variable like soβ¦
let myFunction = function () {
// this is a function body
}
And for our function to execute we call it like so..
// calling a function
myFunction()
We also know Arrays allow us to store a list of information, we might have a list of string, a list of numbers, a list of objects and a list of whatever we like..
let myArray = [/* everthing here is called an Array */]
// Storing a string in Array
let stringArray = ['Pray', 'for the', 'World against', 'Corona Virus']
// storing numbers
let numberArray = [1, 2, 3, 4, 5]
We can also store an object inside of Array and when we do that, we call it Array of Objects...
// storing object in an Array
let objectInArray = [{name: 'Collins', age: 25}, {name: 'Nora', age: 19}, {name: 'Andrew', age: 29}]
We also know it can be true or false, when we use the if statement or Array method to manipulate Arrays/Arrays of Object and we expect true or false which is called a Boolean, only then do we have access to the individual objects or Arrays.
// Arrays to manipulate
let objectToManipulate = [{name: 'Agbeze', age: 25}, {name: 'Nora', age: 19}, {name: 'Andrew', age: 29}]
// manipulating Arrays with find method
const manipulateArrays = (functionParameter) => {
const result = objectToManipulate.find((insideArray) => {
return insideArray.age === functionParameter
})
console.log(result.age === 25) // we are printing TRUE to the screen
}
// calling our function
manipulateArrays(25)
We also know about numbers in JavaScript, where we perform math related operations. When working with Numbers in JavaScript , it can also include some Math related methods like so..
// a random number is coming back
let num = Math.floor(Math.random() * (10 - 20)) + 10
If you actually know how to do all these stuffs, then I believe you know JAVASCRIPT.
BRAVO!!!
Top comments (2)
I started learning Python it is very much like javascript which I already know. So i think that all javascript developers should learn Python as well. Because having more than one scripting language will strengthen you skillset and open up the door to more job opportunities.
yeah, that's right!