Sunday, August 31, 2014

Five Common Questions from JavaScript Beginners

What is JavaScript?


JavaScript is an easy-to-use version of programming language (a constructed language that communicates instructions to a computer).  JavaScript is a scripting language (this means it is a programming language that supports scripts, which can interpret and automate the execution of tasks). Developed by Brendan Eich, while working for Netscape Communications Corporation, this program code was designed to appeal to nonprofessional programmers.  JavaScript runs inside an Internet browser. JavaScript is not a stand-alone programming language.  JavaScript is designed to embed information  in a web browser.  JavaScript includes the following features: dynamic typing and has first-class functions.  

Is Java the same as JavaScript?

Though both Java and JavaScript are both programming languages they are also immensely different.  Java is a very complex programming language while JavaScript is an easy-to-use version that is great for those beginners learning about program languages.  JavaScript and Java have the same expression syntax, naming conventions, and basic control-flow constructs.  JavaScript was previously named LiveScript; the name change has caused much confusion between Java and JavaScript.  Java is a programming language that can be used as a ‘stand-alone’ whereas JavaScript must rely on the environment it is operating in.


How Does JavaScript Work?

JavaScript works by placing code within a Web page.  When a browser loads the page, the built in interpreter reads the JavaScript code it finds within the page and runs it.


What is JavaScript Used For?

JavaScript is mostly used to allow ‘client-side’ scripts to interact with the user.  It is also used to control a Web browser, alter content that is displayed in a document, game development, as well as desktop and mobile applications.  Real life applications where this can be used (outside of web pages) include PDF documents, site-specific browsers, and desktop widgets.


What are the Various Data types used in JavaScript?

Number: Numbers can be written with or without decimals and may use scientific (exponential) notation if they are large enough. Does not allow the use of non-numbers such as NaN.

String: Strings are written with quotes.  Either double or single. 
Boolean: Can only have two values: true or false.
Array: Arrays use square brackets ‘[]’ while separating elements with comas.
Object: Objects are written with curly brackets ‘{}’. Comas separate each pair while the colon ‘:’ separates the name from its value.
Null: An empty value.  Variables can be emptied by setting the value to null.
Undefined: The value of a variable with no value.

Right brain, meet left brain. We're the whole brain. Objective in Salt Lake City, Utah is a web development and design firm with both creative and technological expertise. Learn more about Objective. .