Jump to content

L8V2L

Members
  • Posts

    788
  • Joined

  • Last visited

Posts posted by L8V2L

  1. In this book that you suggest for me to read: http://eloquentjavascript.net/chapter2.html speak on a variable as an octopus that grasp the value, than looking at a variable as a book shelf or etc on how would could think of variable... but guessing that this is just to give an ideal even know the author speak on speaking of this as it should be speaking on. I click the wrong tab on my browser, and though you brought me somewhere else. I'm going through the developer MDN JavaScript guide. That book you brought back in to mind when you first link it to me, I was enjoying it until it got to something way advance, so I stop reading it cause I didn't want to go on not understanding. So please understand that, if I don't feel comfortable, or feel like I have a understand of something, and plus I only want beginner tutorial, so... I rather for you to not to say advance topic, for I feel like I.... let me try again explaining it. So a closure is when you grasp(set)the operation of evaluating in a function scope(the environment for which it is define) in the identifier(variable) so now cause in a sense froze or made an opening into the function scope by attaching it to a variable, you can now access that scope. Is this some what correct?There is question in the first one I give that I desire and need to be answer, so I'mma revise it:A closure seem like to me as a variable just grasping(setting/attaching) the parent function name to that identifier(variable)... I'm guessing the power of this is that as doing so can gain access into that function by such means as the pet.setName(), mean that if this was a mathematic function, I can gain access through that function as so pet.setName(). In putting any value as I please between the parentheses... So in turn, that would show case it's true power, cause of that fact since I define the parent's function name in pet, by pet grasping it, I can use the variable name pet to access all other sub-level function or child function of the parent function.... (meaning is that I could put in a number in a mathematic operator and it'll return a different value by that scope(here by saying this I'm answer my only question that I ask farther into the read, but I don't know if this true or not, I'm asking in different scope, do that value skip the parent scope, and just be operated in the scope that define the mean of access(mean that pet.getName() by putting a value in this, and this scope is set in the middle, does the operation which is define in the scope above it does not apply to this value, as if... for example, the first scope the parent scope, is addition, the second scope, the child scope, is subtraction, and this scope is multiplication, the value if set in the multiplication as so pet.mltiplication(3) will be multiple, and not go through any of the other operation define before it for the simple fact is that scope outside of another scope does not have access to that scope, but that scope does have access to the other scope variable)))If true(and please, despite me typing this, I still would like a more in depth perceptive of this from some one who is a wizard... if that term is not use as I though it was than please excuse mean. When I say wizard, I'm referring to one who is experiences in programming. For I am a novice.)than does this mean by typing pet.setName() I skip the parent function and went to the second level or the first child of the nest function. Same for pet.getSex(); and pet.getName(); Do that mean again, I skip to these nested function, meaning that my value that I set between the parentheses, does not get touch by any of the function that follow it, but not the function that proceed it, so the value is pass through those function? As I said, if this is correct, still please explain to me in your own perceptive, or and the perceptive of the greater practice.

  2. So my explanation is wrong? I feel as if your way of exampling it is... I'll be more secure with this if I could example it back. So my explanation is wrong?

     

    What's the link for?

  3. A closure is an inner function having access to its external scope when the outer function has completed. I doubt it makes any sense for you to be studying this topic yet. Can you even write a simple function to put the date on the screen or count button clicks or validate a simple form?

    I don't mind feedback, but yours is more of a, you can't do this, or you can't do that, despite the fact that I say over and over again I WANT A STRONG FOUNDATION OF JAVASCRIPT!!!!!!!!!!!!!!!!! let me put it in my signature so you can always remember that I reach for a strong foundation of JavaScript.
  4. Recursive functions (functions that call themselves) have some use, but again they aren't something you are going to need regularly. I never need them in Javascript. I think you are going "down the rabbit hole" with this tutorial. You need to practice writing ordinary, practical functions and not advanced techniques. As you mention above, you are unfamiliar with simple things such as the parse functions, so it does not make much sense for you to be studying closures and OOP.

    You got it wrong, I'm all about the foundation, I'm going down the list with these tutorial, and going to go back over! A parses function like parsesfloat and parsesInt are two function that parses through a string to look for number. a parsesfloat function look for any number, - + sign, and decimal sign, any thing else, it'll ignore and return everything previses. Example: -132.3423d3244234, from this number it'll return -132.3423. parsesInt only return hold number, so with the same example, it will return only, 132(don't want to look back(cause I'm trying to go off of memorize), but I believe that it's) it convert -132 to 132 or I think integer number also have negative, but isn't saying -10 the same as 0.1. Any way, I'm going through tutorial to for-memorize my self.... What's is advance? Tell me that? What is advance programming? With each tutorial, I make sure it's start at a beginner level, or even stay at a beginner level, don't tell me such a thing(I don't want it to effect me, such words). If a tutorial step over the line of beginner stage, I stop reading it. Did it before.

    How to distinguish a recursive function from a non-recursive one? This:function factorial(n){ if ((n == 0) || (n == 1)) return 1; else return (n * factorial(n - 1));} Notice that factorial is the name of the function, but inside the function factorial is used.

    Thank you Ingolme!So a recursive function contain the name of it's function inside the function it self correct? Please answer anyone, and more feedback on that, cause it can't be the simple.(I'm not doubting you, just would love to read more feedback on this.)
  5. How you feel about these justsomeguy and anyone else.coffescriptAmber SmalltalkHaxeDartOpaTypeScript, an open-source, strict superset of Javascript language from Microsoft.Rapydscript,[20] a translator with a more Pythonic syntaxLiveScriptGorillascript, which offers additional type checking and syntactic sugar for common JS patterns such as inline callbacks

  6. This is an...a(what's the different between a and an?) closure:

        var createPet = function(name) {      var ######;            return {        setName: function(newName) {          name = newName;        },                getName: function() {          return name;        },                getSex: function() {          return ######;        },                setSex: function(newSex) {          if(typeof newSex == "string" && (newSex.toLowerCase() == "male" || newSex.toLowerCase() == "female")) {            ###### = newSex;          }        }      }    }        var pet = createPet("Vivie");    pet.getName();                  // Vivie        pet.setName("Oliver");    pet.setSex("male");    pet.getSex();                   // male    pet.getName();                  // Oliver
    A closure seem like to me as a variable just grasping the parent function name... I'm guessing the power of this is that as doing so can access into that function by such means as the pet.setName(), mean that if this was a mathematic function, I can gain access through that function as so pet.setName(). In putting any value as I please between the parentheses... So in turn, that would show case it's true power, cause of that fact since I define the parent's function name in pet, by pet grasping it, I can use the variable name pet to access all other sub-level function or child function of the parent function.... If true(and please, despite me typing this, I still would like a more in depth perceptive of this from some one who is a wizard... if that term is not use as I though it was than please excuse mean. When I say wizard, I'm referring to one who is experiences in programming. For I am a novice.)than does this mean by typing pet.setName() I skip the parent function and went to the second level or the first child of the nest function. Same for pet.getSex(); and pet.getName(); Do that mean again, I skip to these nested function, meaning that my value that I set between the parentheses, does not get touch by any of the function that follow it, but not the function that proceed it, so the value is pass through those function? As I said, if this is correct, still please explain to me in your own perceptive, or and the perceptive of the greater practice.
  7. Try-catch etc. -- this isn't as important in Javascript as it is in most other languages because you can generally avoid most errors. For example the parse functions do not need to be wrapped in a try-catch statement the way they would be in some other languages.

    If I only need what a prase function is... feel free not to tell me if you don't want to, for I am sure I will come to pass it in my studies... But it would be nice to have some prior knowledge of it, so when I do come to it, I'll have more of an easier time to gain the concept of it, and it's use.
  8. A function can be recursive; that is, it can call itself. For example, here is a function that computes factorials recursively:

    function factorial(n){  if ((n == 0) || (n == 1))    return 1;  else    return (n * factorial(n - 1));}//computing the factorials of one through five as follows:var a, b, c, d, e;a = factorial(1); // a gets the value 1b = factorial(2); // b gets the value 2c = factorial(3); // c gets the value 6d = factorial(4); // d gets the value 24e = factorial(5); // e gets the value 120
    What make this a recursive function?And how do one distinct such a function from one that is not?And how would one go about to rewrite such a function?My thought on this(and I'm only typing this so you don't think, I'm just coming to you when I don't understand without trying to understand) is that it can call it self(go figure) mean that it does not need console.log to evoke it.(but please explain as if I had not written this, another perceptive can be insightful).
  9. I know, ... it just as you all said, the only way to learn this is to play with it, which I'm I see that now(I like to say starting to see since I'm a novice still). You can't teach no one how to code, just the rules, and practices that been displayed over time as away of using the value to communicate to the console.So the return statement acts as a break, ( ; ), and console.log(in the aspect of it print back to the call, the it's value)...SO return cease the function environment after it return a value which the function either alter or just past to the return through the parameter.So return statement return a value to the caller, and cause the interpreter to continue on to the following code.

  10. Oh... so returns act as ; for the hold function, stopping it... like a break statement.

    //What's up with this:var sum = 0;var obj = {prop1: 5, prop2: 13, prop3: 8};for each (var item in obj) {  sum += item;}print(sum); // prints "26", which is 5+13+8 // Console keep saying it's missing a ')'
    function test1() {  var retval = 1;  for (var i = 1; i < 100; i++) {    retval *= i;  }  return retval;}console.log(test1(1));//return this 9.33262154439441e+155 no matter what number integer I put in. 
  11. Don't tell me you guys believe it too?post-172009-0-08808700-1398149452_thumb.jpgWho here is a flash developer?What your thought on flash vs html5... even know html5 is still primitive... And I even seen the compares... thought when referring to html5 in this matter, I'm of course speaking on JavaScript.

  12. function test1() {  var retval = 1;  return 'test1';  for (var i = 1; i < 100; i++) {    retval *= i;  }  return retval;}// By the look of it, i will increment by 1 until it's 99// retval is the value 1, and will be time by i value// after i under go increment by 1 so... in this sequence retval *=i, it'll go// 1 *= 2, 2*=3, 6*=4, 12*=5, 60*=6, 360*=7, ... and that's all I'm doing by mind// I'm guessing you left out the parameter on purpose, if not, than the code don't // work for I try inputting it (after I figure out what it does of course) in to// the console, as console.log(test1(1)); and it throw or print to the console // test1, put in 2 and it still throw back test1... So I guess I don't know what // it's doing unless you ready did left out a parameter... it also print back undefined//preceding test 1 (above test1)
  13. Hey guys, I look at this earlier. I understand the math and every thing, but I'm studying... a guide on JavaScript, just concentrating on that... it's more of a dictionary of JavaScript. When I get done with that, I will come back to this, even know I brief over it, and even with davej earlier expression, I understood, but... wanted more than simple explanation.... I don't know.... I just want to know JavaScript. I want to have it as my foundation, as a concrete slab to stand on that way I can have a programming language underneath my built, to which I can go and adventure off to other programming language which JavaScript's components reflects... But really I'm just aiming to know only HTML5 and CC3(Which I will have to go back over it, not cause I don't understanding it, cause their more to it(Which I am fine how things went to me moving on to JavaScript to find out that, those two HTML5 CSS3 can do more than just presentation and documentation, which I know I just want to have a foundation of that to(Which is truth is easier to grasps))) I thank you all for such dedication to all of this... I don't know what you get out of it, and true-fully I don't care. I'm just thankful your hear to help. Thank you all.

  14. //Yes I know. I'm talking about this!1.function sum(levels) {2.    if(levels <= 1) {3.        return levels;4.    } else {5.        return levels + sum(levels - 1);6.    }7.}8.console.log( sum(4) );Expected ';'// This is straight from the console, copy and paste.
  15. Please! Run your code through a console first!!! I appreciate the walk through and time to write it for me, but syntax error!!!!!!!!And I try to find out where is the error, but I can't. I though it might be do to your first return not having a ; at the end of the statement it return, but that not it... But it is an error the less, for every statement should end with a ; or I'll just be an expression. Why is their a we in there... We would indicate self awareness and plural, more than one. It should be just "have the value of" in my opinion.... Why? Go ask Neo.

  16. function sum(levels) {    if(levels == 1) {        return levels + 1;    } else {        return levels + sum(levels - 1);    }}/*When I put in 1 it give back two, put in three it give back 7... I can't even guess on if I put in 2, cause the simple fact is I can't see the operation. I understand that:*/function sum(levels) { // that console.log(sum(1)); is the same as var levels = 1;     if(levels == 1) { // So if levels === 1        return levels + 1; // it'll add one, and output or console will print out 2.    } else { // if levels don't equal 1 or if this was a else if (levels !== 1)        return levels + sum(levels - 1); // than.. what? levels add to sum(levels - 1)?    } // if I go with that thinking than, putting two in their and it run in their two}// times than levels + sum(1) + levels + sum(1)= 4... I do hope this shows you that I am/* taking this all very serous, despite my hindrance(see signature). And that I do want to learn this. Please, what is the mind set of this, the pattern of thinking. This is appose to imitate human logical to some degree of comprehend.*/   /*The if(levels == 1) Should be if(levels === 1) triple equal sign for the fact that I can simple put in "1" a string value 1, and it will take it, than return it as 11. strangely enough it'll cause the console to return out of stack space, if I do input a string value of 1 in there... You might be thinking what that got to do with what I'm trying to teach you, will if I did not stress on the detail, I could write the same mistake in my program if I don't stricken my JavaScript foundation in the beginning*//*Do you know any material that can help me advance myself in the understanding of this? books, online tutorial, etc. Please, I been non-stop studying JavaScript. Please, I want to release my creativity in this, and make something of myself with this.*/ 
  17. Recursive means a function that calls itself. This function sums all the numbers from 1 to the number you give it:

    function sum(levels) {    return levels + sum(levels - 1);}console.log( sum(5) ); // Shows 15 which is 1 + 2 + 3 + 4 + 5

     

    It's cause stock to over flow.
  18.  

    I'm currently reading this: http://eloquentjavascript.net/2nd_edition/preview/04_data.htmlIt's a good read as it break down the building blocks of JavaScript up to chapter 3 chapter 4 is like the author switch his audience to those who have experience with coding, but not JavaScript.I went to complete it, but not move on if I don't understand one part of it.I'm thinking of go here to continues to studies: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Values,_variables,_and_literalsFor it break it done too... even if a little wordy... and more to those who have some knowledge of programming...I want to have a strong foundation of a JavaScript... If you know o f any good book that explains all of JavaScript fundamental in a short read... 15 chapter or so or less, please share.Thanks for the replies and help Ingolme and davej.

     

  19. /*What's the point of the document get??? I put it in the console and it return nothing. It seem like this wasn't a vialed lesson.  Unless you wanted me to rewrite it so I'll show me the answer in try it.for example:*/function kryptonite(){var test = 1;document.getElementById('out1').innerHTML = 'test 1'; if(test==='1'){document.getElementById("out1").innerHTML=test;}if(test===1){document.getElementById("out1").innerHTML=test;} }/*That's the only I could have seen the result instead of mixing it up with non related matter as you did... Your like the book I'm reading, keep jumping back and forth from beginner to intermediate.*/   
×
×
  • Create New...