Jump to content

L8V2L

Members
  • Posts

    788
  • Joined

  • Last visited

Posts posted by L8V2L

  1. Scalar values are the 3 primitive types listed in the Microsoft article.The word "reference" has a special meaning in programming. In Javascript, some things are references to objects, other things are actual objects. It's not a philosophical difference or opinion, it's what technically happens.

    var d = new Date(); // d is a Date objectvar e = d; // e is a reference to an objecte.setDate(10); // e is changed// even though only the e variable was changed, both variables show the same value because e is a reference to dconsole.log(d);console.log(e);var a = 10; // a is set to a scalar valuevar b = a; // the value of a is copied to bb++; // b is changedconsole.log(a); // a stays the same because b is not a reference to aconsole.log(; // b is different
    I was wrong about this:Where did that come from? Do you know what object properties are?The computer doesn't care what your opinion is. A function is a kind of object. Like I said, nearly everything in Javascript is an object.Yes, delete only works on object properties, not local variables. When you create a global variable, it is actually a property of the window object, so it can be deleted. Local variables in functions cannot be deleted. Compare what happens when you run these two, one of them creates a global variable which is a property of the window object, and the other creates a local variable inside an anonymous function:
    var y = 43;console.log(this);console.log(this.y);console.log(delete y);console.log(y);
    (function() {var y = 43;console.log(this);console.log(this.y);console.log(delete y);console.log(y);})();
    There's a discussion about the delete operator here:http://perfectionkills.com/understanding-delete/

     

    Scalar values are the 3 primitive types listed in the Microsoft article.The word "reference" has a special meaning in programming. In Javascript, some things are references to objects, other things are actual objects. It's not a philosophical difference or opinion, it's what technically happens.

    var d = new Date(); // d is a Date objectvar e = d; // e is a reference to an objecte.setDate(10); // e is changed// even though only the e variable was changed, both variables show the same value because e is a reference to dconsole.log(d);console.log(e);var a = 10; // a is set to a scalar valuevar b = a; // the value of a is copied to bb++; // b is changedconsole.log(a); // a stays the same because b is not a reference to aconsole.log(; // b is different
    I was wrong about this:Where did that come from? Do you know what object properties are?The computer doesn't care what your opinion is. A function is a kind of object. Like I said, nearly everything in Javascript is an object.Yes, delete only works on object properties, not local variables. When you create a global variable, it is actually a property of the window object, so it can be deleted. Local variables in functions cannot be deleted. Compare what happens when you run these two, one of them creates a global variable which is a property of the window object, and the other creates a local variable inside an anonymous function:
    var y = 43;console.log(this);console.log(this.y);console.log(delete y);console.log(y);
    (function() {var y = 43;console.log(this);console.log(this.y);console.log(delete y);console.log(y);})();
    There's a discussion about the delete operator here:http://perfectionkills.com/understanding-delete/

     

    Found it... there isn't anyway to refer to posts that I liked(say the d).
  2. The function doesn't return anything, there's nothing to log.Sorry you feel that way, I disagree. If you did a little research then you could find some books written by some very well-known programmers, like Douglas Crockford. Like us, their goal is to teach, not waste peoples' time.That's because online tutorials are shallow. Documentation is just documentation, it's not a learning manual. One of the most popular books has 1100 pages, do you think you're going to find more information in a free online tutorial or an 1100 page book?Then seriously, move beyond online tutorials. The next step is books. The step after that is classes. Find some computer science classes at a community college. Don't focus too much on Javascript specifically, you need to understand computer science theory to be an effective developer.People don't go through online tutorials to learn how to repair engines, or build houses, there's no reason that developing applications is any different. It is a trade, a craft, and an art. If you want to be good then you need to learn from someone good. Douglas Crockford has some material online, look at that for a start if you really don't want a book for whatever reason.http://shop.oreilly.com/product/0636920027065.dohttp://shop.oreilly.com/product/9780596805531.dohttp://shop.oreilly.com/product/9780596517748.dohttp://shop.oreilly.com/product/9781593275402.do

    Appreciate the words and links. Please let me rephrase, I understand by the accusations of programming raving about these books... What I mean to say is, I come to like the here it is approach. I'm not saying them books aren't good read, I'm saying I come to love to here it is approach, where their is no talking, their is no joking, just the information, and an explain. I can come to see as those books will contain the author's experience, knowledge, skills, and trick they learn upon the way of their career. I will come around to sitting down, and picking them up to read. But I'm mostly interested in a straight forward book, it can have a little bit of history, and did you know parts in it, but for mostly, I come to love, here it is. Cause with that, with every sentences, I'm gaining knowledge on the subject at hand, not of the author speaking of something which ties in to the we are talking about, but add no real value/knowledge for me to know. I use to think this approach was boarding, but I come to value it, I come to see cause the fact that I want to learn this, I want to not waste time with it, I want to not read long books which a percent of it contain amusement, and laughter(unless it ties directly into the subject to where I'll get knowledge from it).Please note, I have not excuse non of the books you gave me, I just wish to countertrade on memorizing myself with the components of JavaScript, and it's syntax.Thanks for talking the time to reply to my post.
  3. I think you are spending too much time on oddball cases and "cute" code that has little or no usefulness. Why don't you see if you can write something useful that works?

    I'm studying the syntax structure basic so I can know the components by heart(Cause I love JavaScript). I'm also looking at other people code...(with little to know understand of them) but starting to recognize some to all the components of the code.That's why I ask you to give me code to read, and then ask what is it doing.
  4. Because that's how the stack work. Scopes get added, then removed. The scope with 3 got added first, so it gets removed last.I've given you several links to some very good books, but you don't want to read them.

    Okay... So like the name imply, stack; if it get stack 1, 2, 3 then it must get un-stack; starting from the last one to be put on the stack. 3, 2, 1. Cause, The interpreter need to un-stack them in order, so it can return back to where it left off at.
  5. ;// So a cursive function, is a function that calls it self, as so:  function factorial(n) {    if ((n == 0) || (n == 1))       return 1    else {       var result = (n * factorial(n-1) ); // call it self.       return result    } }factorial(1);//1factorial(2);//2//Can you give me more example, and explaining?
  6. Do you know what a stack is?

    A stack is the memory... or reminder for the interpreter to where he left off or and which number, or string, or call back it is on.

    Why would it be? What is the first statement in the function?

    less than 0. Why do it go back up to three than?I for got to put something in my last message I left. their a saying that I never been told to myself, but what love to do. RTFM or RTFD. Well I WOULD LOVE TO READ THE ######ING MANUEL AND DOCUMENT! JUST GIVE ME THE LINK TO DO SO!
  7. It's not doing anything when I long it in the console.log(loop(0));And I don't want to read another author(look what I know, and spend money and time learning nothing) book. Those book feel like a lot of the tutorial website, just out to waste your time. I want a guide, a guide straight to the point with i.e. every step of the way. I read over w3school three time and mdn guide three time. But I don't feel like I'm advancing. I'm looking at this as a career... I want to make games with this.Do you know any guide books on html, css, javascript; html5? Do you know any guide books for beginner leading toward intermediate, crossing over to advance, and introducing technical. Not where you have a block of words with the author talking about himself, or what he feel or believe. but straight to HERE! THIS IS WHAT YOU NEED TO KNOW, AND HERE MORE REFERENCE IF YOU WANT TO KNOW MORE! book.

  8. function foo(i) {   if (i < 0)      return;   document.writeln('begin:' + i);   foo(i - 1);   document.writeln('end:' + i);}foo(3);begin:3begin:2begin:1begin:0end:0end:1end:2end:3
    Stack like behavior it said. How it this so? How can it not be negative for the end:?
  9. can be converted into a recursive function and a call to that function:function loop(x) {   if (x >= 10) // "x >= 10" is the exit condition (equivalent to "!(x < 10)")      return;   // do stuff   loop(x + 1); // the recursive call}loop(0);
    So a recursive function, is a function that can call it self... but every function can do that.Will not every function, you have function that can call them self one time i.e. (function(param0, param1, paramN){}()); or (function(param0, param1, paramN){})(); or they can be attach to a variable i.e. var fun = (function(){})(); or var fun = (function(){}());If some of you don't want to be bother with my question anymore, just give me a link to where I can go and ask them.
  10. This 'assign the parent to FunctionName.prototype.__proto__ instead. For example, WorkerBee.prototype.__proto__ = new Employee; This way, (new WorkerBee).constructor yields expected "WorkerBee".*/'What is it doing? is it the same as WorkerBee.prototype = new Employee?If I can find a book that have less talking and more learning, I want a book that is like w3school or and mdn guide, straight to the point, with picture.DO you know a book like that?

  11. The difference is that line 17 assigns the object to a prototype instead of a variable. What don't you understand about the comment at the end?

    This 'assign the parent to FunctionName.prototype.__proto__ instead. For example, WorkerBee.prototype.__proto__ = new Employee; This way, (new WorkerBee).constructor yields expected "WorkerBee".*/'And do you know where I should go next? I like you documentation on mdn, it was up front. I say this, w3school and mdn have the best so far, easier to understand. I read both a least three times already. but I... I don't know where to go.. cause of 'read pic' I need to be able to hover over one site, or I'll be every where. Please, do you know where I can go next?
  12. 1. function Employee(){2. this.name='';3. this.dept='general';4. }5. Employee;6.7. var Manager = new Employee();8. 9. Manager.reports = [];10. 11. Manager;12.13. function WorkerBee(){14. this.projects = [];15. }16. 17. WorkerBee.prototype = new Employee;18. 19. WorkerBee;/*Note: Directly assigning to FunctionName.prototype removes its original prototype's "constructor" property. As a result, (new WorkerBee).constructor yields "Employee" (instead of expected "WorkerBee"). Care must be taken to preserve the original prototype's constructor. For instance, assign the parent to FunctionName.prototype.__proto__ instead. For example, WorkerBee.prototype.__proto__ = new Employee; This way, (new WorkerBee).constructor yields expected "WorkerBee".*/
    What's the different between line 7 and 17? And at the bottom, what are they referring to? Speaking of?
  13. JavaScript ClosuresRemember self-invoking functions? What does this function do? At least it preserves the counter:Example

    var add = (function () {    var counter = 0;    return function (x) {return counter += x}}())add(10);add(15);console.log(add(20));// the counter is now 45
    So this is a self invoking function... is it?
  14. I have told you how to determine if a function is recursive or not. If it is calling itself then it is recursive.

    .... Is it invoking it self?Show me one of your drawing!
×
×
  • Create New...