Basic Fundamental of JavaScripts

JavaScript, like most programming languages, requires the basic fundamentals in order to completely comprehend the language. JavaScript is an object-oriented programming language, therefore, a beginner requires the need to understand what a term like “object” means, and what “functions” are. The inability to understand and grasp these concepts and terms can lead to a slippery slope toward failure.

JavaScript Fundamentals

The language known as JavaScript is an old language, released about 24 years ago. However, despite being almost a quarter of a century-old its basic fundamentals have remained the same. In this post, the following will be discussed and walked through to provide an understanding for any beginners who wish to learn JavaScript: variables, data types, objects, and functions.

Variables

A memory location that is used as a container for a stored data is known as a variable. These types of containers are reserved memory locations.

Example of variable:

let food;
food = tacos

Data Types

When assigning a variable with a value, the variable will contain a specific type of data within it. JavaScript allows a user to assign different types of values to a variable as long as it is an integer or a string. In JavaScript, there exist five different data types. These data types are numbers, strings, boolean, undefined, and null.

Objects

Objects in JavaScript are considered variables. However, they can contain too many values and may make things complicated. Rather than declaring separate variables for each property, you can declare an object that stores all of the properties.

Declaring objects in JavaScript can easily be done using let. This also allows the use of curly brackets that allows the user to form property-value pairs.

Example of Objects:

let person = {
name = "John"
favoriteFood = "tacos"
};

Functions

Functions in JavaScript can easily be declared simply by using the keyword, ‘function’. A JavaScript function is a block of code that can be invoked when it is called. Once called it will perform the specific task that it was designed for.

Example of Functions:

function sum(a,b) {
return a+b
}

With this, it now concludes a quick and brief guide to JavaScript for beginners. Although, this entire post does not cover a lot of other information such as arrays, conditional statements, and loops. This was to provide information on JavaScript-centric topics and allow one to hopefully get a bit of understanding of what to expect. Nevertheless, to truly understand JavaScript, one must attempt and challenge this language head on.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store