##What is JavaScript? Created by Brendan Eich in 1995 for the Netscape browser
###Features
- functional
- object oriented
- asyncronous
- event-based
- prototypical
- Mocha (May 1995) initial development
- LiveScript (Sep 1995) beta Netscape release
- JavaScript (Dec 1995) final Netscape release
- was presented as the "little brother" of Java
- main purpose was to ease the pain of deploying Java webapps
- language/spec: ECMAScript
- dialects: JavaScript, JScript, ActionScript, QML
All the standard operators
There is none! If the client executes it, the user can edit it.
###inline script tags
- Don't do this!
- No Seperation of Concerns
<html>
<head></head>
<body>
<script type="text/javascript">
console.log('This is bad! Use this as a last resort!')
</script>
</body>
</html>
###on* attributes
- It is still good practice to avoid this.
- Not a complete seperation of concerns.
- To use your own functions you would have to expose them to the global namespace.
- Can be useful for quick hacks and debugging.
<input type="button" onclick="alert('that hurt!')">click me!</input>
###including external scripts
- Do This!
- speration of concerns
- Makes it easier to find all your logic
<head>
<script src="scripts/main.js" type="text/javascript"></script>
</head>
###selecting elements
document.body
document.getElementById()
document.getElementByTagName()
###creating elements
var para = document.createElement("p")
var text = document.createTextNode("Welcome to the DOM!")
para.appendChild(text)
document..getElementById('intro-header').appendChild(para)