DEV Community

loading...
Cover image for How I started JavaScript

How I started JavaScript

javiercunat profile image JavierCunat Updated on ・4 min read

Hello Enthusiasts of the Computer Science World!

What is JavaScript?

JavaScript can be the biggest step you can take in your developer career, however when first starting JavaScript it was the hardest thing to grasp, I remember being confused and frustrated along the way. Although this is true I'm here to tell you this is the right option and you need to stick through it, just like learning any language with enough time and practice you will become fluent. Lets stay strong and stay determined.

JavaScript was created in 1995 by the Netscape web browser, it was a way to add actions to websites, JavaScript is like the verb of a website, call to action. In 1995 it was a way to beat the competition, JavaScript became the standard also called ECMAScript when it was first introduced. Every website nowadays uses an excessive amount of JavaScript for example, adding something to your cart on Amazon, signing in to your account in any website, liking a post on DEV, virtual reality, robotics, this is all made possible through JavaScript. This one skill will take you very far into your career and opens up a lot of possibilities, however take things step by step and think simply that JavaScript is just a file that you can write instructions to a computer telling it to do as you desire and code.

Principles of JavaScript

First lets talk about JavaScript types, there a seven types or primitive values , you can open and try these commands in any console, example go to any website, right click, inspect element, open console:

JavaScript Types Examples
Number 2+2 = 4
String "Hello" + "World"
Boolean Represents and Gives either True or False
Undefined Used when nothing is assigned to a variable
Null the value represents the intentional absence of any object value
Symbol returns a value of type symbol, has static properties that expose several members of built-in objects
Object objects are containers for named values called properties or methods they follow name:value pairs

Secondly we have JavaScript Comparisons, these come in very useful with Booleans and they are very simple to understand as they are literally just comparing any type to another:

JavaScript Comparisons Examples
!== 3!==3 the ! basically means not, therefore 3 doesn't not equal three would return false
=== 3=3 would not work therefore always 3===3
>= 3>=3 three is greater than or equal to three would return true
<= 3<=3 three is less than or equal to three would return true
> 3>3 would return false
< 3<3 would return false

Next you would look into JavaScript Variables now this is when JavaScript starts to get fun, this is how a program starts to remember things. A variable stores something and we can access that content through it for example:

var post = "This is my blog about starting JavaScript"
// Type in post now in console 
post
"This is my blog about starting JavaScript"
Enter fullscreen mode Exit fullscreen mode

These variables are super important and can hold any type of content here are the different ways of calling them:

JavaScript Variables Examples
var var= "hello" the first and basic way to declare a variable
let let= "hello" the new and improved version to declare a variable
const const="hello" unlike the other two this variable you cannot modify its not interchangeable like others, hence its constant

Fourth on the list is JavaScript Conditionals, these conditionals are to control and make decisions that you have written in your code, there are a few:

JavaScript Conditionals Examples
if basically if would say if this is right then right true
else if its anything other than the if or later on else if then finally run this
else if the computer would run after the if the else to see if that is correct to run that

For example:

var name = "Billy"
if (name === "Billy") {
   alert("hi Billy!");
}
Enter fullscreen mode Exit fullscreen mode

P.S. All alert() does is make a pop up for the user to display that information that it is correct so the computer will return a pop up saying HI Billy! when running in console.

Afterwards there are three logical operators in JavaScript. Although they are called “logical”, they can be applied to values of any type, not only boolean. Their result can also be of any type. Let's take a look:

JavaScript Logical Operators Examples
&& The AND operator is represented with two ampersands &&. AND returns true if both operands are truthy and false
"//" OR is meant to manipulate Boolean values only. If any of its arguments are true, it returns true, otherwise it returns false
! The Boolean NOT operator is represented with an exclamation sign ! Converts the operand to Boolean type: true/false. Returns the inverse value.

Finally we have JavaScript Functions these are the most important values you will learn in JavaScript to execute everything, they are pieces of code that perform actions, without them JavaScript wouldn't really do anything these actions can preform one or multiple. All functions are followed by () these call the function and then are {} these are the arguments, what's given to functions. These are different types of function:

JavaScript Functions Examples
var a = function name() {} function declaration
function name () {} anonymous function
return this returns a value in a function, it's important to have this to make sure the function acts the way we want it to
console.log() the Console method log() outputs a message to the web console

Function Explanation Diagram
Alt Text

Hopefully now you have a better understanding of JavaScript and realize that it goes a lot further than just these principles and fundamentals which you should practice and master to continue your path smoothly. I hope it wasn't as bad as you thought because at first I really did, and if you're still not there continue practicing, make fun simple projects I believe those maximize your understanding and comprehension in a not so frustrating way. Thank you for reading and remember to keep coding!

Discussion (7)

pic
Editor guide
Collapse
dummyko profile image
dummyko

|| === OR

Collapse
dummyko profile image
dummyko

// comment

Collapse
camden profile image
Camden Garcia

As someone currently relearning Javascript, this is a lifesaver. Thanks!

Collapse
javiercunat profile image
JavierCunat Author

Glad I could Help!

Collapse
kolajo profile image
kolajo

Great write up, it's actually covers most critical basic topics you need to know about Javascript

Collapse
javiercunat profile image
Collapse
carodiazz profile image
Carodiazz

helped me learned about JavaScript thank you!!