Don's Home
Programming Languages
Javascript
|
Under Construction
Javascript® (often shortened to JS) is a lightweight, interpreted, object-oriented programming language with which is interpreted by web browsers (Google Chrome, Internet Explorer, Safari, Firefox, Dolphin...) . JavaScript can also be used in applications outside web pages--for example in PDF-documents, site-specific browsers and desktop widgets, but it's most common use is in web pages.
It was created by Netscape (now Mozilla) in the late 90's.
See: JavaScript is one of the 3 languages all web developers must learn:
Examples: React to events on a web page. Examples of events built into browsers onmouseover, onmousedown, onmouseup, onclick Bookmarklets AlertsObject-oriented Language: Javascript is an object-oriented language. The object-oriented programming (OOP) is a programming paradigm uses "objects" - data structures consisting of properties (data fields e.g. color) and methods (program code - something an object can do) together with their interactions. For example a circle object could have: properties: x,y coordinates of the center and r -radius methods: Area - Calculate the area draw - print a circle with the properties in the objectSee Introduction to Object-Oriented JavaScript at mozilla.org. JavaScript Tutorial | w3schools.com
DOM - Document Object Model:
Web pages use HTML (Hypertext Markup Language) to tell browsers how to display the information (text, graphics) and what to do with links or other objects.
Standards:
Libraries-Frameworks:
jQuery is a DOM (Document Object Model) manipulation library built in JavaScript to automate and simplify common tasks.
Others: jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, interactions for rapid web development. jQuery is designed to change the way that you write JavaScript (jquery.com). There is a free license for non-commercial projects available from MIT or GNU. JavaScript copies many names and naming conventions from Java, but the two languages are otherwise unrelated and have very different semantics.
Examples:
ExamplesOnMouseOver is a function built into browsers. When you put your mouse over "onMouseOver" above it will display a comment at the bottom of your screen. e.g. onMouseOver="window.status='MouseOver function';return true;" onMouseOut="window.status='';return true;"
Hide telephone numbers from web crawlers:
Development tools: JSON JavaScript Object Notation (JSON) is a language-independent data format. It derives from JavaScript, but as of 2016, code to generate and parse JSON-format data is available in many programming languages. It uses human-readable text to transmit data objects consisting of attribute-value pairs. It is the most common data format used for asynchronous browser/server communication (AJAJ), largely replacing XML which is used by AJAX. JSON Example {"employees":[ {"firstName":"John", "lastName":"Doe"}, {"firstName":"Anna", "lastName":"Smith"}, {"firstName":"Peter", "lastName":"Jones"} ]} The following XML example also defines an employees object with 3 employee records: XML Example <employees> <employee> <firstName>John</firstName> <lastName>Doe</lastName> </employee> <employee> <firstName>Anna</firstName> <lastName>Smith</lastName> </employee> <employee> <firstName>Peter</firstName> <lastName>Jones</lastName> </employee> </employees>Search for JSON Bookmarklets: A bookmarklet is an applet, a small computer application, stored as the URL of a bookmark in a web browser or as a hyperlink on a web page. They are frequently JavaScript commands to extend the browser's functionality. See more about bookmarklets. Books: JavaScript: The Definitive Guide: Activate Your Web Pages O'Reilly by David Flanagan JavaScript, A Beginner's Guide, Third Edition by John Pollock jQuery Cookbook: Solutions & Examples for jQuery Developers, O'Reilly, by Cody Lindley Top 10 Best JavaScript Books that Beginners should Read - tripwire magazine 5 JavaScript Books Worth Every Cent
Links:
Is JavaScript an Object Oriented Programming (OOP) Language ?:
Aza Raskin says at (www.azarask.in/blog/post/making-javascript-syntax-not-suck/), Note that I am not arguing that Javascript isn’t a beautiful or powerful language, just that its syntax is a vestigial meme left over from a time when we didn’t know better." PythonicJavascript (pyScript) (still under development) is an attempt to make it better.
| |
// Pyscript function triangle(a,b): if a > 0 && b > 0: function sqroot(x): if x > 0: return Math.pow(x,.5) else: return 0 return sqroot( a*a + b*b ) else: return 0 |
// Javascript function triangle(a,b){ if(a > 0 && b > 0 ){ function sqroot(x){ if( x > 0 ){ return Math.pow(x,.5); } else { return 0; } } return sqroot( a*a + b*b ); } else { return 0; } } |
Acknowledgement: Thanks to Evan Willams for advice. See New Holland Press Blog
|