JavaScript, Origins, Variables, Data Types, and Boolean Logic

&& || !

JavaScript is often abbreviated as JS. In May 1995, Netscape Communications recruited Brendan Eich to write the prototype that we call today JavaScript. He wrote this in only ten days, although I think it was probably the result of a longer process.

Oracle owns the trademark over Javascript, but since Netscape created The Mozilla Foundation, Mozilla is the organisation that maintains JavaScript.

“Before JavaScript, web browsers were fairly basic pieces of software capable of displaying hypertext documents. JavaScript was later introduced to add some extra spice to web pages and to make them more interactive. The first version, JavaScript 1.0, debuted in Netscape Navigator 2 in 1995. “.

By 1996 JavaScript, called initially ECMAScript started to gain ground by being standardised by Netscape and Sun, together with the European Computer Manufacturers Association (ECMA).

Facts

  • JavaScript is a lightweight computing language. It doesn’t take too much memory from a computer, and has a relatively simple syntax.
  • JavaScript works cross-platform, or in other words, on the client-side and server-side.
  • It is an object-oriented programming (OOP) language, based on objects. This means that it defines the structure of the data but also the types of operations (functions) that can be applied.
  • JavaScript is a very flexible language that allows us to add interactivity to objects but also develop complex web applications.
  • JavaScript is one of the core development tools of the net. The core development tools are HTML, CSS and JavaScript.

Where does JavaScript fit with HTML and CSS?

So giving an example of the following paragraph below, we would say

“Estela went to code some beautiful live paintings.” – “Estela” would be the content, the Noun. – “went to code” would be a verb, the action, so would be JavaSript. – “beautiful live paintings” would be the adjective, the style so that it would be the CSS.

Variables and Data Types

Variables are containers that store values so that these values can be reused over and over again. We could be a variable that stores diffrent values throughout our life.

So a variable would be a piece of memory, just like the example below

var firstName = ‘Estela’;

Our names seem something so natural, but at some point we had to understand how our name was connected to us, as children. Therefore we need to log this information to our brains and conscience.

The same happens in a computer.

var firstName = ‘Estela’; console.log(firstName);

If you write this you will see on your console the result

Estela

There are different Data Types

Number, String , Boolean , Undefined, Null

Number

Contains numbers (floating-point numbers that in other works may contain a fractional part).

var age = 46

String

Uses characters, text

var firstName = ‘Estela’;

Boolean

Logical data type that can be true or false

var firstName = ‘Estela’; console.log(firstName); var lastName = ‘Gaspar’; var origin = ‘Mars’; var origin = false; console.log(origin);

Undefined

When there is no value assigned

Null

Doesn’t exist

Boolean Logic for True and False

The boolean data type can have several options for True and false. For instance if we have a variable of age

var age = 16; age >= 20; // Is age bigger or equal to 20? False age = 20 || age < 30; // Is age bigger or equal to 20? Is age smaller then 30? One of them is True

AND &&

var firstName = ‘Estela’; var age = 400; if (age = 500 && age < 35) { // False console.log(firstName + ‘ is a woman.’); } else { console.log(firstName + ‘ is an alien.’); // True }

Returns: Estela is an alien.

OR ||

var firstName = ‘Estela’; var age = 400; if (age = 300 || age < 500) { // True console.log(firstName + ‘ is a woman.’); } else { console.log(firstName + ‘ is an alien.’); // True }

Not !

var firstName = ‘Estela’; var age = !400; if (age = 500 || age < 35) { // False console.log(firstName + ‘ is a woman.’); } else { console.log(firstName + ‘ is an alien.’); // True }

Returns: Estela is a girl.

Shop

Get a print to put in your home or office wall. Contact estrelaestela@icloud.com

Sources:

https://stackoverflow.com/questions/20858048/where-is-javascript/20858098, 4th October 2018, 14:28 p.m.

https://en.wikipedia.org/wiki/JavaScript#Trademark, Wikipedia, 4th October 2018, 14:28 p.m.

https://en.wikipedia.org/wiki/JavaScript, Wikipedia, 4th October 2018, 14:28 p.m.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.8.5, MDN web docs, 4th October 2018, 14:28 p.m.

A Brief History of JavaScript, Springer link, Apress, Berkeley, CA, 4th October 2019, 14:06 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s