Posted in Uncategorized

JS Post 6 – JS the OOP Language (╯⊙ ⊱⊙╰ )

So I was looking through my previous posts and I realized that I got a bit carried away with JavaScript that I forgot that I haven’t actually posted anything about JavaScript. I apologize that I took it for granted that almost everyone knows about JS.

A little history lesson wouldn’t be so bad, I guess?

 JavaScript has come a long way to become what it  is today. The history of JavaScript isn’t necessary to know, but having some background knowledge always perked my interest. So let me just go ahead and tell a story

…φʕ•ᴥ•oʔ

In 1995, there was a dilemma with form validation. Visitors were filling out forms and there was a huge problem with them forgetting to fill a certain field. Sometimes a field wasn’t filled in correctly.

Now, this may not seem like a problem because back then there were server side languages that could handle this. The real problem was the time it took to send this data, process it and then display a message back. Back then, the average internet speed was 28kpbs.

(╬⁽⁽ ⁰ ⁾⁾ Д ⁽⁽ ⁰ ⁾⁾)Yikes!!

You would end up waiting 30 seconds just for a message to tell you that you forgot to fill in your phone number. It was then that, Netscape Navigator started working on a solution to fix this. Netscape Navigator was the most popular web browser with over 80% of the internet users using it.

Netscape had the idea with processing the user input with client-side code. Meaning you would get an error message right away telling you that you forgot to fill in a certain field and you wouldn’t end up wasting your time. The first version was called JavaScript 1.0.

The name was supposed to be LiveScript, but Java was getting a lot of attention, so they decided to feed off of that attention by naming it JavaScript instead. The language was praised by many and so that resulted in an update called JavaScript 1.1.

(•̀ᴗ•́)൬༉

Things started to get a little hectic as JavaScript grew. Microsoft decided it was time to get in on the action. So, they developed their own client-side language called JScript. However, it wasn’t documented and was really confusing, so it never became anything. LOL

((( ̄へ ̄井)੭೨

Netscape became scared anyway. They realized that they must make JavaScript standardized. So, in 1997, they submitted JavaScript 1.1 to ECMA (European Computer Manufacturers Association).

A committee was formed to standardize the language. This was made up of various tech geniuses from various tech giant companies. After many months of hard work, they released a whole new language called ECMAScript.

ECMAScript became a general purpose language. No longer was it a scripting language for the web. Here’s the thing, ECMAScript became a basic language. It didn’t have any way of taking in input or outputting data. JavaScript is based on this standard.

You can call it JavaScript or ECMAScript. Either one works. Since JavaScript is a general-purpose language, it’s up to the software to extend JavaScript. Basically, your browser has a JavaScript interpreter. This interpreter gives you access to different functions and objects. Things like the DOM is only in browsers and not part of the ECMAScript standard. Things like conditional statements, variables, functions, and data types are all part of ECMAScript.

(∩⌣̀_⌣́)

By 2008, all browsers complied with the ECMAScript third edition. By this time, The fifth edition of ECMAScript, the current version ( chrome://version/ on your browser!!!). It was released in 2009. After 5 editions, JavaScript has completely changed since it’s beginnings. No longer is it a scripting language, but a fully functional language.

You can use it to create apps or even perform server side logic! I’ve skipped quite a few things, but it would be one huge read if I didn’t.

¯\_(⊙︿⊙)_/¯

HTML File : You should be able to find a somewhat rushed HTML file having the basic OOP concept on JS

Documentation : On ECMAScript, they have sample code? well, it is the documentation what do ya expect?

YouTube : Playlist on Modular JS

If you’re wondering where to go next, then you should check out a couple of frameworks. If you’re interested in front-end work, then check meteor.js, ember.js or undersore.js. If you want to do server-side programming, then check out node.js and check out express.js for a framework.

(〠_〠)

// <![CDATA[ var bits=100; // how many bits var speed=50; // how fast – smaller is faster var bangs=5; // how many can be launched simultaneously (note that using too many can slow the script down) var colours=new Array("#03f", "#f03", "#0e0", "#93f", "#0cf", "#f93", "#f0c"); // blue red green purple cyan orange pink var bangheight=new Array(); var intensity=new Array(); var colour=new Array(); var Xpos=new Array(); var Ypos=new Array(); var dX=new Array(); var dY=new Array(); var stars=new Array(); var decay=new Array(); var swide=800; var shigh=600; var boddie; if (typeof('addRVLoadEvent')!='function') function addRVLoadEvent(funky) { var oldonload=window.onload; if (typeof(oldonload)!='function') window.onload=funky; else window.onload=function() { if (oldonload) oldonload(); funky(); } } addRVLoadEvent(light_blue_touchpaper); function light_blue_touchpaper() { if (document.getElementById) { var i; boddie=document.createElement("div"); boddie.style.position="fixed"; boddie.style.top="0px"; boddie.style.left="0px"; boddie.style.overflow="visible"; boddie.style.width="1px"; boddie.style.height="1px"; boddie.style.backgroundColor="transparent"; document.body.appendChild(boddie); set_width(); for (i=0; i<bangs; i++) { write_fire(i); launch(i); setInterval('stepthrough('+i+')', speed); } }} function write_fire(N) { var i, rlef, rdow; stars[N+'r']=createDiv('|', 12); boddie.appendChild(stars[N+'r']); for (i=bits*N; i1.25) stars[N+”r”].firstChild.nodeValue=”/”; else if (dX[N+”r”]<-1.25) stars[N+"r"].firstChild.nodeValue="\\"; else stars[N+"r"].firstChild.nodeValue="|"; stars[N+"r"].style.color=colours[colour[N]]; } function bang(N) { var i, Z, A=0; for (i=bits*N; i1 && Math.random()<.1) { Z.visibility="hidden"; setTimeout('stars['+i+'].style.visibility="visible"', speed-1); } Xpos[i]+=dX[i]; Ypos[i]+=(dY[i]+=1.25/intensity[N]); } if (A!=bits) setTimeout("bang("+N+")", speed); } function stepthrough(N) { var i, M, Z; var oldx=Xpos[N+"r"]; var oldy=Ypos[N+"r"]; Xpos[N+"r"]+=dX[N+"r"]; Ypos[N+"r"]-=4; if (Ypos[N+"r"]<bangheight[N]) { M=Math.floor(Math.random()*3*colours.length); intensity[N]=5+Math.random()*4; for (i=N*bits; i<bits+bits*N; i++) { Xpos[i]=Xpos[N+"r"]; Ypos[i]=Ypos[N+"r"]; dY[i]=(Math.random()-0.5)*intensity[N]; dX[i]=(Math.random()-0.5)*(intensity[N]-Math.abs(dY[i]))*1.25; decay[i]=16+Math.floor(Math.random()*16); Z=stars[i]; if (M<colours.length) Z.style.color=colours[i%2?colour[N]:M]; else if (M0) sw_min=document.documentElement.clientWidth; if (document.documentElement.clientHeight>0) sh_min=document.documentElement.clientHeight; } if (typeof(self.innerWidth)!=”undefined” && self.innerWidth) { if (self.innerWidth>0 && self.innerWidth0 && self.innerHeight0 && document.body.clientWidth0 && document.body.clientHeight

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s