Jump to content

L8V2L

Members
  • Posts

    788
  • Joined

  • Last visited

Everything posted by L8V2L

  1. Maybe I don't understand it in that content... You calling test is the same as FIRST calling exec(); calling them both? You're saying while calling them both, exec() first? That what it look like.
  2. Calling test() is equivalent to calling exec() and returning true if the return value of exec() is not null. Because of this equivalence, the test() method behaves the same way as the exec() method when invoked for a global regular expression: it begins searching the specified string at the position specified by lastIndex, and if it finds a match, it sets lastIndex to the position of the character immediately following the match. Thus, you can loop through a string using the test() method just as you can with the exec() method.No it's not! exec(); return an array of items, or null. test(); return a Boolean value!!!!!!! MMMMMMMMMMAAAAAAAAAAAAAWWWWWW!!!!!!!!
  3. 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. 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!
  5. 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!
  6. 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.
  7. 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
  8. 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?
  9. 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.
  10. 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).
  11. L8V2L

    Help!

    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.
  12. 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.
  13. 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?
  14. I'm looking more at the increment, does it skip the increment the first time around?
  15. 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.
  16. 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?*/ }
  17. 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."
  18. // 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
  19. ...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.
  20. // 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
  21. I heard of that it is great as simplifying programming... Is it even more simpler than JavaScript in that aspect(JS programmer for life!). And is that possible for adobe to do?
  22. It can still come back... if abode open source it.
  23. 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.*/ };}
  24. 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...*/}
×
×
  • Create New...