Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Javascript
- // Brendan Eich was the inventor and it took him 240 hours
- // Has some problems but became compatible by Ecma
- // called Mocha then LiveScript then JavaScript
- // Brendan Eich is working on Web Assembly
- // www.destryallsoftware.com/talks/wat
- // Extend JavaScript with...
- D3js
- EmberJS
- Node
- Quake
- var fizzbuzz = function(num) {
- var f = num%3 === 0
- var b = num%5 === 0
- };
- var fizzbuzz = function(num) {
- var f, b;
- f = num%3 === 0;
- f = num%5 === 0
- };
- var fizzbuzz = function(num){
- var f = num%3 === 0, b = num%5 === 0;
- return f ? b ? "FizzBuzz" : "Fizz" : b ? "Buzz" : num;
- };
- }
- // JS CONTINUED
- var firstName = 'Yngwue';
- // After keywords that are commands
- continue;
- return "Hi";
- break;
- // ; in loops
- for (i = 5; i; i--) {
- console.log();
- }
- 'use strict';
- // Scope
- function return();
- return name;
- }
- retunName(); //nothing
- var name = "Steven";
- function returnName(){
- return name;
- }
- returnName(); // "Steven Works great!
- function setName(newName){
- var name = newName;
- }
- setName("Steven");
- name; //undefined
- // env scope
- var name;
- function setName(newName){
- name = newName;
- }
- setName("Steven");
- name; // "Steven"
- // IIFE
- var secret;
- (function myFunction(){
- secret = 42;
- })();
- secret; // 42 mah sekretz
- // arrays
- var array = [];
- array.push("Denise");
- array.forEach(function(techer))
- console.log(teacher);
- })
- //hashes
- var teachers = {
- avi: "Rails",
- steven: "JavaScript",
- jonathon: "HTML & CSS"
- }
- for(var teacher in teachers){
- console.log(teacher + " teaches " + teachers[teacher])}
- }
- var steven = {
- name: "Steven",
- introduce: function(){
- return "Hi! I'm " + this.name;
- }
- }
- steven.introduce(); //Hi! I'm Steven
- var num_array = [1, 2, 3, 4, 5]
- for(i; i < cars.length; i++)
- console.log("Value of local veriable:" + string(i));
- end
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement