Jump to content

L8V2L

Members
  • Posts

    788
  • Joined

  • Last visited

Posts posted by L8V2L

  1. Keep in mind that the ECMAScript specification and a browser's Javascript implementation are not necessarily the same thing. The specification says one thing, but any browser vendor can implement Javascript however they want. Ideally, they all follow the specification. In reality, they don't. Each browser uses its own set of rules even though they might all be based on the ECMAScript specification. IE throws syntax errors that other browsers ignore or allow.

    THATS STUPID!!!!!!Do nodes.js follow the ECMAScript rules? If so.... In others news: take a look at this stupid explanationExample 8-1. A simple JavaScript class
     // range.js: A class representing a range of values.  // This is a factory function that returns a new range object. function range(from, to) {     // Use Object.create() to create an object that inherits     // from the prototype object defined below. The prototype     // is stored as a property of this function, and defines     // the shared methods (behavior) for all range objects.     var r = Object.create(range.methods);     // Save the start and end points (state) of the object.     // They are noninherited properties unique to this object.     r.from = from;     r.to = to;     // Finally return the new object     return r; } // This prototype object defines methods inherited by all // range objects. range.methods = {     // Return true if x is in the range, false otherwise     includes: function(x) {         return this.from <= x && x <= this.to;     },     // Invoke f once for each integer in the range.     // This method works only for numeric ranges.     foreach: function(f) {         for(var x=Math.ceil(this.from); x <= this.to; x++)             f(x);     },     // Return a string representation of the range     toString: function() {         return "(" + this.from + "..." + this.to + ")";     } }; // Here are example uses of a range object. var r = range(1,3);      // Create a range object r.includes(2);           // => true: 2 is in the range r.foreach(console.log);  // Prints 1 2 3 console.log(r);          // Prints (1...3) 
    When I go over tutorial and example; I like to write them in the console for hands on. This guy that wrote this is stupid like the broswer. THIS!!!! The bad part about this is I have to finish this stupid book!Can some one explain to me and possible rewrite it so I can have more of a hands on experience.THERE MUST BE BOOKS THAT GIVE NOTHING BUT EXPLANTATION FOR YHE CODE FOLLOW BLY THE CODE AND MORE EXPLANATION. He stay on subject but it could be a lot better.And spell check for this mobile version!
  2. Keep in mind that the ECMAScript specification and a browser's Javascript implementation are not necessarily the same thing. The specification says one thing, but any browser vendor can implement Javascript however they want. Ideally, they all follow the specification. In reality, they don't. Each browser uses its own set of rules even though they might all be based on the ECMAScript specification. IE throws syntax errors that other browsers ignore or allow.

    THATS STUPID!!!!!!Do nodes.js follow the ECMAScript rules? If so.... In others news: take a look at this stupid explanationExample 8-1. A simple JavaScript class
     // range.js: A class representing a range of values.  // This is a factory function that returns a new range object. function range(from, to) {     // Use Object.create() to create an object that inherits     // from the prototype object defined below. The prototype     // is stored as a property of this function, and defines     // the shared methods (behavior) for all range objects.     var r = Object.create(range.methods);     // Save the start and end points (state) of the object.     // They are noninherited properties unique to this object.     r.from = from;     r.to = to;     // Finally return the new object     return r; } // This prototype object defines methods inherited by all // range objects. range.methods = {     // Return true if x is in the range, false otherwise     includes: function(x) {         return this.from <= x && x <= this.to;     },     // Invoke f once for each integer in the range.     // This method works only for numeric ranges.     foreach: function(f) {         for(var x=Math.ceil(this.from); x <= this.to; x++)             f(x);     },     // Return a string representation of the range     toString: function() {         return "(" + this.from + "..." + this.to + ")";     } }; // Here are example uses of a range object. var r = range(1,3);      // Create a range object r.includes(2);           // => true: 2 is in the range r.foreach(console.log);  // Prints 1 2 3 console.log(r);          // Prints (1...3) 
    When I go over tutorial and example; I like to write them in the console for hands on. This guy that wrote this is stupid like the broswer. THIS!!!! The bad part about this is I have to finish this stupid book!Can some one explain to me and possible rewrite it so I can have more of a hands on experience.THERE MUST BE BOOKS THAT GIVE NOTHING BUT EXPLANTATION FOR YHE CODE FOLLOW BLY THE CODE AND MORE EXPLANATION. He stay on subject but it could be a lot better.And spell check for this mobile version!
  3. Keep in mind that the ECMAScript specification and a browser's Javascript implementation are not necessarily the same thing. The specification says one thing, but any browser vendor can implement Javascript however they want. Ideally, they all follow the specification. In reality, they don't. Each browser uses its own set of rules even though they might all be based on the ECMAScript specification. IE throws syntax errors that other browsers ignore or allow.

    THATS STUPID!!!!!!Do nodes.js follow the ECMAScript rules? If so.... In others news: take a look at this stupid explanationExample 8-1. A simple JavaScript class
     // range.js: A class representing a range of values.  // This is a factory function that returns a new range object. function range(from, to) {     // Use Object.create() to create an object that inherits     // from the prototype object defined below. The prototype     // is stored as a property of this function, and defines     // the shared methods (behavior) for all range objects.     var r = Object.create(range.methods);     // Save the start and end points (state) of the object.     // They are noninherited properties unique to this object.     r.from = from;     r.to = to;     // Finally return the new object     return r; } // This prototype object defines methods inherited by all // range objects. range.methods = {     // Return true if x is in the range, false otherwise     includes: function(x) {         return this.from <= x && x <= this.to;     },     // Invoke f once for each integer in the range.     // This method works only for numeric ranges.     foreach: function(f) {         for(var x=Math.ceil(this.from); x <= this.to; x++)             f(x);     },     // Return a string representation of the range     toString: function() {         return "(" + this.from + "..." + this.to + ")";     } }; // Here are example uses of a range object. var r = range(1,3);      // Create a range object r.includes(2);           // => true: 2 is in the range r.foreach(console.log);  // Prints 1 2 3 console.log(r);          // Prints (1...3) 
    When I go over tutorial and example; I like to write them in the console for hands on. This guy that wrote this is stupid like the broswer. THIS!!!! The bad part about this is I have to finish this stupid book!Can some one explain to me and possible rewrite it so I can have more of a hands on experience.THERE MUST BE BOOKS THAT GIVE NOTHING BUT EXPLANTATION FOR YHE CODE FOLLOW BLY THE CODE AND MORE EXPLANATION. He stay on subject but it could be a lot better.And spell check for this mobile version!
  4. I was so gay(could have use happy, but I feel this word best fit the description) when I saw p.js, but as I study on the side more and more of svg, I'm sway by it's beauty. svg being a distance relative to html, and css components, it feel I'm strengthen my knowledge on those two(which I'm probably not... I don't know).... I don't even know why I typing this. I guess, I'm hoping for something else to give a feedback on this pulling of the heart.

  5. It means that if you call the Function() constructor inside another function it won't have access to the other function's variables:

    function test() {    var x = 3;    var a = new Function("alert(x);");    a(); // Error: x is not defined}test();

     

    Thanks! I understand the message cause of your explanation... But not the depth... If you could explain lexical scoping to me. But if not, that's cool.Thanks again for the over all meaning.lexical scoping
  6. A very important point about the Function() constructor is that the functions it creates do not use lexical scoping; instead, they are always compiled as if they were top-level functions: they can access global variables, but not any local variables.What does this mean?

  7. This is a function statement:

    function testfunc() {}
    This is a function expression:
    var testfunc = function() {}

     

    Yes I know... but thinks for typing out, I still get confuse. But this post was referring to what I read in the book, to which I copy and paste it in the opening of this post. I use both of these in an if statement, and they work. The book was incorrect on that; which said it wouldn't work. I'm hopping someone could tell me I read it incorrectly, cause as an novice, it's important to make sure that what I'm reading be the absolute truth.
  8. YOU GUYS HAVE A MOBILE VERSION, AND DIDNT TELL ME!!! MMMMMMMAAAHHHH!So I'm reading js pocket version the 3rd edition, and in it, it state; function declaration statements are not true statements, and the ECMAScript specification only allows them as top-level statements. They can appear in global code, or within other functions, but they cannot appear inside of loops, conditionals, or try/catch/finally or with statements. Note that this restriction applies only to functions declared as statements. Function definition expressions may appear anywhere in your JavaScript code.From what I gather is that a function statement is with the var... Binding the function to a variable name. And a function expression declare a function with the function key word. If that's correct, then this is wrong. I but it in an if else statement, and it works. Anyone care to clarbrate(share, talk, etc... Pretty sure I spell that word wrong).

  9. The result is adding an extra 1 to it because I didn't think out the function well. Explaining why might be a bit complicated unless you understand the function. The key to the recursion is this line:return levels + sum(levels - 1);sum() is the function that is currently being executed. First, I'll fix the function to remove the error I had:

    function sum(levels) {    if(levels <= 1) {        return levels;    } else {        return levels + sum(levels - 1);    }}console.log( sum(4) );
    Now I'll do what's called a "trace". That means I pretend I'm the computer and I follow the instructions
    # 8. Call sum() and pass 4 to it# # Inside sum() [level 1]# 1. levels is 4# 2. Is levels less than or equal to 1? It isn't, so go to line 5.# 5. We need to call sum() again, but give it (levels - 1), which is (4 - 1 = 3)#       Store the current value of levels in the stack: stack is [4]# #    Inside sum() [level 2]#    1. levels is 3#    2. Is levels less than or equal to 1? It isn't, so go to line 5.#    5. We need to call sum() again, but give it (levels - 1), which is (3 - 1 = 2)#       Store the current value of levels in the stack: stack is [4, 3]# #       Inside sum() [level 3]#       1. levels is 2#       2. Is levels less than or equal to 1? It isn't, so go to line 5.#       5. We need to call sum() again, but give it (levels - 1), which is (2 - 1 = 1)#          Store the current value of levels in the stack: stack is [4, 3, 2]# #          Inside sum() [level 4]#          1. levels is 1#          2. Is levels less than or equal to 1? Yes, it's 1, so go to line 3.#          3. Return levels, which is 1# #       Inside sum() [level 3]#       5. We have the value of sum()[level 4], it's 1, so add that to levels,#          which is the last element in stack [4, 3, *2*], levels = 2.#          Return (levels + 1) = (2 + 1) which is 3,#          then remove the element from the stack: stack = [4, 3]# #    Inside sum() [level 2]#    5. We have the value of sum()[level 3], it's 3, so add that to levels,#       which is the last element in stack [4, *3*], levels = 3.#       Return (levels + 3) = (3 + 3) which is 6,#       then remove the element from the stack: stack = [4]# # Inside sum() [level 1]# 5. We have the value of sum()[level 2], it's 6, so add that to levels,# which is the last element in stack [4], levels = 4.# Return (levels + 6) = (4 + 6) which is 10,# then remove the element from the stack: stack is empty## 8. Print out the return value of sum(4): 10

     

    Hey Ingolme, thanks for this reply post again. You didn't make any mistake(which you already knew.). I probable forgot to take off the number when I enter it in the console to be long out.What tool do traces for me? What type of tools also give time and speed info on each line of code? If you know of any, please tell. Thanks for those post again.
  10. Normally games don't use vectors, so canvas is preferrable for games. Game programming is highly complicated. SVG and canvas are two separate, independent technologies. If you want them to work together you're going to have to build your own program that does it. The only way to do that is if you fully understand how to interact with both canvas and SVG using Javascript.

    I'm speaking on using only the svg instead of the canvas. Replacing canvas with svg canvas(the svg tag/element/node) as a surface view point for the game interacting and graphic.
  11. I was guided toward svg when I found out about vector resizable feature... now that I went through the svg guide on w3school(which was just a guise of it). I come to wonder if I can use that over canvas api?What do you guys think?Gaming propose, which one would be efficient in formatting games?

  12. No it's not stupid at all. It's all a part of the learning process. :) The reason you're not getting 10 logged is because you're telling the loop to loop through as long as count and i are less than 10. If you change the conditional operator to <= you will see 10 logged.

    Oh NOOOOOOOO!!!!!! Please everyone read this PLEASE!!! I know that, I really do, my mistake, I wasn't paying attention as I was typing... or I wasn't thinking... (refer to the picture.) What I was really asking is 1, who(<-- I look back over this and see a mistake! I meant 'why') did it start at zero no matter if it was post increment, and(another mistake I meant 'or') pre increment. I can't believe that(I made that mistake), please everyone read this... I hope I type this correctly.
  13. var count = 0;while(count < 10){count++console.log(count);//count++}for(var i = 0; i < 10; i++){console.log(i); /*this been puzzling me ever since a while ago. Why won't(... wont... won't <-- What's up with that!) Why won't it log 10 if it is incremented after checking the expression. The onlything that make sense to me is that one is not incremented when console.log it; cause if it was, zero would never log. I thought if I pre-increment it...(Don't know why, but I do things like that, try stupid things  that I know they want work.(I'm the type that would put in a wrong answer to see if it compute right out of experimenting))(<-- I realize that I do the very thing I hate books to do, get off track... to which why I hate it.) But yeah, anyone care to explain?*/ }
  14. The definitive guide(pocket version) is very wordy... at least at the beginning(lexical description). As I said before; "I like reading documentation, manual, guide books with plenty of example toward each topic cover with explanation."(<-- I do best with learning from such format) Hopefully it'll pick up with that later on.Any one have any books that comes to mind with "documentations, manuals, guides with plenty of example toward each topic cover with explanation"There was a part in the book where it said it's okay to leave trailing commas in array. I do not agree, as I learn reading mdn(a couple of times) it is good/better practice to make sure no trailing commas are there, for it is no need if they are going to be ignore by the interpreter(the interpreter first have to read it before it can ignore it(in my opinion; you can't ignore something with out first acknowledging it existence is there.) With that said, it would be reasonable that it'll have some effects on performances.) hopefully this only being chapter three, and not the primary topic for those objects/entities.Again(me not asking of a book, but a particle style/type), do anyone know of any; documentation, manual, guide books with plenty of example toward each topic cover with explanation."

  15. That was already discussed in one of your other topics.http://w3schools.invisionzone.com/index.php?showtopic=50075&page=6#entry277319

    // define the Person Classfunction Person() {}Person.prototype.walk = function(){  alert ('I am walking!');};Person.prototype.sayHello = function(){  alert ('hello');};// define the Student classfunction Student() {  // Call the parent constructor  Person.call(this);};// inherit PersonStudent.prototype = new Person();//Student.prototype.__proto__ = new Person(); <-- USING THIS SEEM TO BE THE BEST SHORTEST WAY./*I don't really understand, but I understand that it set the constructor to Student and not Person, so I guess when making instance, it'll point to Student as the constructor and not Person... Is that correct? What is the benefit of doing this? And harm of keeping it as is?*///correct the constructor pointer because it points to PersonStudent.prototype.constructor = Student;//Student.prototype = Object.create(Person.prototype);// replace the sayHello method//Student.prototype.sayHello = function(){  //alert('hi, I am a student');//};// add sayGoodBye method//Student.prototype.sayGoodBye = function(){//  alert('goodBye');I//};var student1 = new Student();//student1.sayHello();//student1.walk();//student1.sayGoodBye();Person;Student;// check inheritance//alert(student1 instanceof Person); // true //alert(student1 instanceof Student); // true
  16. ActionScript 3 is quite different from Javascript, I would call it more complex. Both are based on Ecmascript though.I don't have much faith in Adobe to do anything correctly.

    ...What's wrong with them! They are people who would do such complication for free if they just throw it on github... it's cause they want money. Did you see that crap they made for developer interface. I'm all open source use. All this show is that there is old head running the show, and if they can't make all the money, then they rather not make no money.
  17. // define the Person Classfunction Person() {}Person.prototype.walk = function(){  alert ('I am walking!');};Person.prototype.sayHello = function(){  alert ('hello');};// define the Student classfunction Student() {  // Call the parent constructor  Person.call(this);};// inherit Person <--- L8V2L QUESTION FOR THIS!!!!Student.prototype = new Person(); // <-- I look in both IE, and firefox console and saw the different in commented this out and uncommented this out, but do not understand what it imply. Anyone? clarity? // correct the constructor pointer because it points to Person//Student.prototype.constructor = Student; // replace the sayHello method//Student.prototype.sayHello = function(){  //alert('hi, I am a student');//};// add sayGoodBye method//Student.prototype.sayGoodBye = function(){//  alert('goodBye');I//};var student1 = new Student();//student1.sayHello();//student1.walk();//student1.sayGoodBye();Person;Student;// check inheritance//alert(student1 instanceof Person); // true //alert(student1 instanceof Student); // true
  18. It's a fine authoring tool, which doesn't mean anything if nothing supports it.

    I heard of that it is great as simplifying programming... Is it even more simpler than JavaScript in that aspect(JS programmer for life!).

    Flash would only survive if Adobe makes it possible to export a Flash project as HTML5 without losing any functionality.

    And is that possible for adobe to do?
  19. function makePerson(first, last){ return{  first:first,  last:last };}function personFullName(person){  return person.first + " " + person.last;}function personFullNameReversed(person){  return person.last + ', '+person.first;}s = makePerson("Simon","Willison");personFullName(s);personFullNameReversed(s);function makePerson(first, last) {  return{   first: first,   last: last,   fullName : function(){    return this.first + " "+ this.last;  },   fullNameReversed: function(){    return this.last + ', '+ this.first;  } };}s = makePerson("Simon", "Willison");fullName = s.fullName();s.fullName();//s.fullNameReversed();function Person(first, last){  this.first = first;  this.last = last;  this.fullName = function(){      return this.first + ' ' + this.last;  };  this.fullNameReversed = function(){      return this.last + ', ' + this.first;  }; }var s = new Person("Simon", "Willison");s.fullNameReversed();function personFullName() { /* <-- isn't this and the function that follow it polluting the global namespace?*/    return this.first + ' ' + this.last;}function personFullNameReversed() {    return this.last + ', ' + this.first;}function Human(first, last) {    this.first = first;    this.last = last;    this.fullName = personFullName; /*<-- cause of 'this'(literally and figuratively) this casue the to preseeding fucntion to attach themselves as methods to this function and any other function(construcotr) that happen to both in heirtate and reference to this method/function?*/    this.fullNameReversed = personFullNameReversed;}var hi = new Human("hi", "bye")function Animal(first, last) {    this.first = first;    this.last = last;    this.fullName = personFullName;    this.fullNameReversed = personFullNameReversed;}var dog = new Animal("happy", "joy");  console.log(hi.fullName()+"n"+dog.fullName());function Person(first, last) {    this.first = first;    this.last = last;}Person.prototype.fullName = function() { /*defining the function semantically assigning it to the prototype chain, I would say this is a better way of writing oops, since they have mention that each time the constructor function(and instances) are invoke, they recreate the function they have access to inside them, but with this, it's more of a reference to the function that is in the prototype chain. Please if I'm incorrect, correct me*/     return this.first + ' ' + this.last;};Person.prototype.fullNameReversed = function() {    return this.last + ', ' + this.first;};var s = new Person("Simon", "Willison");s.fullNameReversed();function addHandler() {    var el = document.getElementById('el');    el.onclick = function() {        this.style.backgroundColor = 'red'; // what is the rules for memory leaks?    };}function addHandler() {    var clickHandler = function() {        this.style.backgroundColor = 'red';    };    (function() {        var el = document.getElementById('el'); /* <-- just look at how date is being transform; ones this self invoke function is trigger by the event handler, it automatically assign the variable clickHandler as it's self, and... I mean I see what's going on, but do not understand it... Can some one explain this to me?*/         el.onclick = clickHandler;    })();}//circular references, and memory leaks introduced by a closure:function addHandler() {    var el = document.getElementById('el');    el.onclick = function() {        this.style.backgroundColor = 'red';/*Is when you reference one thing, and transfer back to anotherthing, but because of this creating a closure, date is... is being caught between it going back to the event handler, or to the element node that have an id of el.*/     };} 
  20. This is just amazing:

    var A = ["1", "2", 3];A[100] = "5";A.length;typeof(a[50]);for(var i = 0, item; item = A[i++] { // <-- this actually perform a Boolean action.console.log(A[i]);}for(var i = 0; i < A.length; i++){var item = A[i];item !== undefined ? console.log(item):"foobar/fubar/baz"; /* I made this one after writing the three example they display to me. The other one just being a regular for loop. Ternary, it so cute! This one is better due to the fact that the other one will stop iterating when it come across an undefined(or falsie value, 0 exception) meaning, it'll never reach 5; but this iteration do the same, but give two an option solution that does nothing; i.e. foobar/fubar/baz. When I think about it, this could had been done with the filter, forEach, ... a couple of other comes to mind but they want do the job as great as they would, if they where design for it... I need to study/go over them more! Arrays are an important part of JavaScript; just as everything else in JavaScript. But those should be efficient enough with a function holding... or just having that as a parameter "item I== undefined?console.log(item):foobar;"similar to what is displayed above with out the for loop. for in work good, but it is said if I remember correctly that should be use with objects. in an Array, it'll iterate everything...*/}
  21. This is... I don't know how I feel about this...

    // I understand what's going on giving the time to studying it a little.function makeIterator(array){    var nextIndex = 0;// this increment by one         return {       next: function(){           return nextIndex < array.length ?               {value: array[nextIndex++], done: false} : // <-- here. it increment by one when               {done: true};       }    }}var it = makeIterator(['yo', 'ya']);console.log(it.next().value); // 'yo'// You write it out here with console.log.console.log(it.next().value); // 'ya'console.log(it.next().done);  // true/* By looking at it that what I guess is going on, this is from mdn, and is a new ecma-script 6 proposal... May 14, 2014 7:36:13 PM <== is when it was edit the page I copy this example of The Iterator protocol. I don't know how... I understand by looking at it, but how it set up, I don't think I could give a self example of it.*/
  22. JavaScript: The Definitive Guide, 6th Edition and the pocket version seem to be the type of book I like to read... I have to say; their is something about reading online that I like more... but this book seem to be by type of book. I scheme through the definitive guide it self, and with what little I read gave no room for shenanigan(that was the word I was trying to spell last time). I read more of the pocket version, it being 250 or something, more or less a few hundred less of the definitive version. And it... as JSG state had everything in the beginning of it as I read on mdn and here... more so wordy then the definition guide one which give a little more example from what I seen then the pocket version, but I only read a little of the pocket version. I guess I like books that give a lot of example and example both before and after the example it self; which w3s, and mdn, and phpd, did nicely. I'm currently reading through the mdn guide and almost finish, at the same time I'm reading xml here to pay my respect to both html and xml... now it comes to my attention that I must read xslt... uh! ... I just wanted to know xml(not even know it, just have some kind of knowledge over the language)... The good thing I like about JavaScript is... will like that guy said which I don't agree on at all! It's like a "glue" his words not mind. But anyway, you need two or more things to glue something with, and with JavaScript, it is pushing me into other language... And it don't even feel as if it is pushing me, I just want to know them cause I can do something with them with JavaScript. I can see how JavaScript alone with html, and css can do amazing things with; you could even make a game out of just them three language(although I would use another approach in stand of that). But with other language; such as svg, and apis... why JavaScript it self have been built on top(or for a better and more respectfully putted(as the core for)) other language to exist, as c and java(I believe from remembering correctly) have been done. I see jQuery and those other library as language of them own; cause if one should actually study jQuery as so, they can use it with out any syntax of javascript(not really as it from javascript, so it is javascript... as adam and eve is of guide more if I shall compare it/give i.g. toward). No other language have done so... by that I mean no other language have complemented it's ancestors as so. JavaScript is an amazing language with a large loving community that are adding on it every minute... it's not even finish and look at what an impact it have cause. That why I want to be a JavaScript Wizard; a pure JavaScript wizard to where those other languages to be snack cakes of delight for me to understand. I may be a novice still, but I'm glad that I by the universal power choose this language to learn... or it choose me...Somewhere in the deep dark space a soft but evil laugh is heard.JavaVader: he-he-he~. Soon... Soon.

×
×
  • Create New...