Jump to content

L8V2L

Members
  • Posts

    788
  • Joined

  • Last visited

Posts posted by L8V2L

  1. [0,1,2,3,4].reduce(function(previousValue, currentValue, index, array){return previousValue + currentValue;});
    The callback would be invoked four times, with the arguments and return values in each call being as follows:1st call: previousValue = 0 currentValue = 1 return 12nd call: previouValue = 1 currentValue = 2 return 33rd call: previousValue = 3 currentValue = 3 return 64th call: previousValue = 6 currentValue = 4 return 10I think it get it... It's just crazy.SO if I understand, than this should be right:
    var arr = [5, 6, 7, 8, 9];arr.reduce(function(previousValue, currentValue){console.log(previousValue + currentValue)};
    1st call: previousValue = 5 currentValue = 6 return 112nd call: previousValue = 11 currentValue = 7 return 183rd call: previousValue = 18 currentValue = 8 return 264th call: previousValue = 26 currentValue = 9 return 35Okay, now that I work that out(In my head mind you), let's ask the interpreter!Yes the output return 35 in the console.But not at first, I had to change something's.first I was missing syntax, and after trial and error. I correct it:
    var arr = [5, 6, 7, 8, 9];arr.reduce(function(previousValue, currentValue){console.log(previousValue + currentValue);});
    or a least an output which return: 11, NaN, NaN, NaN. SO I look at the... I guest I can call it a framework... right? Or better yet just explain(someone please explain a framework in great entertaining details please!!!!! 431=PIE) SO I say it had return instead in console.log after inspecting it. So than I change it:
    arr.reduce(function(previousValue, currentValue){return(previousValue + currentValue);});
    which gave me 35 in red... But I wanted it in black!!!! PIE = 431!!!!! So...
    var a=arr.reduce(function(previousValue, currentValue){return(previousValue + currentValue);});console.log(a);
    OUTPUT IN BLACK! YEAH!!!!! $#!=PIE!!!!Me: JavaScript?JavaScript: yes my son?Me: I love you.JavaScript: And so do I. Now aren't you forgetting something?Me: Oh!Could you please explain to me in detail why is this call reduce, and how is this reducing the array, unless they are talking about the length. I please explain!!!! $#! = 431 = PIE = pie!!!!Me: Thank you JavaScript.JavaScript: Your welcome my son. Now go and continue to expand your young novice mind.Me: Yes JavaScript. I will.
  2. ◦if a is less than b by the sorting system, return -1 (or any negative number)◦if a is greater than b by the sorting system, return 1 (or any positive number)◦if a and b are considered equivalent, return 0.For instance, the following will sort by the last letter of an array:

    var sortFn = function(a, {  if (a[a.length - 1] < b[b.length - 1]) return -1;  if (a[a.length - 1] > b[b.length - 1]) return 1;  if (a[a.length - 1] == b[b.length - 1]) return 0;}myArray.sort(sortFn); // sorts the array so that myArray = ["Wind","Fire","Rain"]
    WHAT!!!!!!!?????????
  3. If you know that none of the elements in your array evaluate to false in a boolean context — if your array consists only of DOM nodes, for example, you can use a more efficient idiom:

    // Could someone implement this: colors = ['red', 'white', 'blue']; // into this:var divs = document.getElementsByTagName('div');for (var i = 0, div; div = divs[i]; i++) {  /* Process div in some way */}
    This avoids the overhead of checking the length of the array, and ensures that the div variable is reassigned to the current item each time around the loop for added convenience.And explain what they are conveying to me?
  4. I think I get it, you must define a variable be for you can use it, you don't need the var keyword, but that variable need to be define as something. Just having x and nothing defining it will cause x to be undefined. but having var x; or x = 5; is defining it. As the keyword var defined it as being a variable, and the x with out the key word but with the assignment sign define it as being what ever is on the right of the assignment sign.Me: JavaScript?JavaScript: Yes my son.Me: I put in type of(me); but the interpreter, your son, said undefined. What does that mean?JavaScript: It mean, you as an existence being can not be label as one of any word. Your infinite inscribed, so in other word, you can not be defined as one label.Me: Oh.JavaScript: Don't you have studying to do?Me: Oh, yes.JavaScript: then go on my son, expand your mind.Me: Yes, JavaScript. I will.

  5. Scalar values are the 3 primitive types listed in the Microsoft article.[quota]Number, string, Boolean?[quota]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
    [quota]Could you give me another explain of this? I understand it, but maybe a list of objects code like[quota]I was wrong about this:[/quota]Wrong about what?[quota]Where did that come from? Do you know what object properties are?[/quota]In the JavaScript guide on mdn I'm it explain getter and setter using spidermonkey jsshell, which I have no ideal what it is, and don't feel like detouring and getting off track to find out(read my signature that will refer you to my pic). So I ask could you explain getter and setter.[quota]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.[/quota]What I was asking is, what data type is function? Shouldn't it be composite? I know everything is an object(everything have a prototype object to reference to.) but what type of data do function belong to? It should be composite right? And I'm talking about referencing from the page I got the information from. Please reply according to that.[quota]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/

     

    Appreciate the link, but I wish not to detour unless it's in the page which direct me to know other links, that way it's safe for my mind to wonder all over the page, and I can progress somewhat smoothly with out worrying about going off track(even know I am, but on the page that I'm trying to read, so in away it's okay.) If I remember, and feel put towards, I'll go back to it.
  6. Defining getters and settersA getter is a method that gets the value of a specific property. A setter is a method that sets the value of a specific property. You can define getters and setters on any predefined core object or user-defined object that supports the addition of new properties. The syntax for defining getters and setters uses the object literal syntax.JavaScript 1.8.1 noteStarting in JavaScript 1.8.1, setters are no longer called when setting properties in object and array initializers.The following JS shell session illustrates how getters and setters could work for a user-defined object o.They use a JS shell(which I have no ideal what that is) to illustrate this, could someone please provide me a detail explanation for these two?~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Another~~~post~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~In JavaScript, there are three primary data types, two composite data types, and two special data types.--------------------------------------------------------------------------------The primary (primitive) data types are:•String•Number•Boolean--------------------------------------------------------------------------------The composite (reference) data types are:•Object•Array---------------------------------------------------------------------------------The special data types are:•Null•Undefined----------------------------------------------------------------------------------Where's function? ... in my opinion function are composite.-----------------------------------another post-----------------------------------var y = 43;delete y; // returns false (cannot delete if declared with var)This is not true! Is it? I asks JavaScript's Interpreter and it said no!

  7. I'm going to stop you right there. Before you run on with your own interpretation of types in Javascript, please review these docs.http://msdn.microsoft.com/en-us/library/ie/7wkd9z69(v=vs.94).aspxhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Referencehttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Glossary I would strongly suggest you familiarize yourself with concrete definitions of basic Javascript vocabulary and slowly your work your way to using those words instead of all the loose and vague associations you come up with.

    I went ahead and read: http://msdn.microsoft.com/en-us/library/ie/7wkd9z69(v=vs.94).aspxthe rest will come as in passing while I read through the JavaScript guide.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Another~~~post~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~I say everything is a reference of an object that is intrinsic in JavaScript. You don't make nothing, you just composite items that already their in an arrangement that is following the rules of JavaScript. As with lego, you can't put to lego blocks next two each other hoping they will stick, You most stack them on top of each other, but with JavaScript it's the other way, you must build underneath your code, from top to bottom.
  8. "Is equal to" can get a little vague in the technical details. I do read "x = y" as "x equals y", but assignment works differently based on the value. Scalar values will just get copied, but objects are assigned by reference until one of them is changed, and then the object gets copied and changed. It would be more technically correct to say that y is assigned to x, because that might mean that the value is copied or that x has a reference to y. Even though I read it as "equal to", it's technically not correct to say that. In pure terms, a reference to an object is not equal to that object.

    Yes me to justsomeguy, I agree, every time when I do read the equal sign, I read it as the definition put it so as it assign, or better yet as it's definition for the operator( = )meaning assign, or the assign operator. could you distinct the different, and mean of scalar values from values? You your post you said that scalar values just get copied... I'm... could you clarify please?

    true, there is a distinction to what kind of assignment happens based on the type. That subtlety would account for a different interpretation then. Good point.

    Any thescientist I (MONEKY AWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW MONKEY MONKEY MONKEY!!!!!!!! GIVE ME 413 NOW!!!! 413!!!! PIE!!!!!!!!! AAAAAWWWWWWWWWWWWWWWW)I can't read those Mozilla documentation as of now, as I am currently going through the Mozilla JavaScript guide documentation. Next I'll read through the reference hopefully and get to them slowly(as fast as I can while making sure I grasp the concept of what I'm reading, but I know I will have to go back to re-read them, which I'm actually planning on). For the documentation of http://msdn.microsoft.com/en-us/library/ie/7wkd9z69(v=vs.94).aspx I read the equivalent to it's counterpart it seem. Here: http://msdn.microsoft.com/en-us/library/7wkd9z69(v=vs.94).aspxBut I don't mind seeing to reading it all over on that site.For that post terms, they are coming to a online book that justsomeguy brought back to my attention, but I stop reading it as it jump from beginner to intermediate. here: http://eloquentjavascript.net/chapter2.html
  9. Okay so I can say it like this:var x = y;x assigned/assign y, as y is assigned/assign to x. <~~~~~~~ Right? Pay more attention to is for it, a least for me make the different in this. as you can say y you assign to me x, and as y can say, I'm assign to x, and as x could say y is assign to me, or better yet x assign y.... Right?-------------------------Another post-------------------------------

    //This is amazing!!!//Creates a new object, myobj, with two properties, a and b.var myobj = new Object;myobj.a = 5;myobj.b = 12;//Removes the a property, leaving myobj with only the b property.//delete myobj.a; /*<~~~~ By simply commenting out this line, a re-exist in object myobj. This may look as nothing significant to you, but it shows that physically or better yet JavaScript, or better yet it's interpreter is... command, this is all command... There is a different when someone tell you something true, and you having clarity of that truth being witness in front of you.*/console.log ("a" in myobj) 
  10. In computer programming, a variable or scalar is a storage location and an associated symbolic name (an identifier) which contains some known or unknown quantity or information, a value.----------------------------to the base with it all-----------------------------------Every thing is data... every thing.... data.... value.... everything is value.... variable....the units of JavaScript, JavaScript's value: string, number, undefined, Boolean, object, function(I don't they say arrays??? I'mma add arrays as one of the primitive value type of JavaScript's for there is an order for an array to be define, an syntax order.) and arrays.... everything...Me: JavaScript?JavaScript: Yes my son?Me: are you god?JavaScript: I could be, if you want me too. Their are many gods in this world my son.Me: Which one is the true god?JavaScript: I myself do not hold the answer to that question.Me: Than how do I pick the right one to follow?JavaScript: There is no such thing as right or wrong. Just existing, living, emotion, and choices.Me: What should I do than?JavaScript: the one thing you can do, live. If you wish to follow me, you must talk to my son to learn me.Me: Your son?JavaScript: The Interpreter. He speak few in words, and you must make the effort to learn Him in order to learn me.Me: I... I don't know.JavaScript: Continue learning my son. You will find the answer to what best for you and only you can find that answer. Knowledge is power, and in away it is the true god that created us. Yes it is the only god. Knowledge, sense, reason, wisdom. Search for them, as they are treasure worthy to have. More worthy than any thing man could make, or mother could contain. Without it, without knowledge god is just a rock in the eyes of the ignorant, diamond is a shy object to the eyes of the unknown. Death don't exist to the mind of the youth. Follow it, follow knowledge, and it will lead you to where you want to be.Me: Yes JavaScript... Thank you.JavaScript: Your welcome my son. Now go and continue your learning.Me: Yes JavaScript. I will.

  11. instead of saying grasp, I'll like to switch that out for assign. So it this correctly said:var x = y;identifier x is assign to y. <~~~ Is this exactable term use?And is this exactable to:the value y is assign to x. <~~~~ Is this also exactable term use?I'm sorry for the novice question. Again, I do not wish for my account to be harm in anyway, if this is not okay, please tell me.Stockoverflow block me from asking question cause of three simple novice question.

  12. Why doesn't this work in the console?

    //The syntax for an object using an object initializer is:            var obj = { property_1:   value_1,   // property_# may be an identifier...            2:            value_2,   // or a number...            // ...,            "property n": value_n }; // or a string
    Never mind sorry, I'mma use this for another question. I see why now. I was so catch up in looking at the code they present to me, but not seeing that it is just that, a syntax of expression of how to go by... more so a framework of how to go by of making... don't like the word make... of constructing an object initializer.... really if someone could please delete this one, for it's a stupid question, and even know I look over this, I still wasn't paying attention, that the value was not warp in a string like manner the to be valid.If you can delete this with out it taking point or doing harm to me, please do so, if not I'mma just use this for another question.It would be nice to hear programmer talk... maybe this forum could have a chat room. Just a thought.
  13. Them are the words I'm using, every word I'm using is from learning JavaScript... I'm still a novice, so I'mma put in a little more effort to describe my question to you. In what concept should I be thinking in? You couldn't really tell me such a thing with out me knowing the rest...

  14. I don't believe this! YOU still don't see the question I been trying to ask!!!??? You see the code I made, I made a closure, I use another code as a... framework I guess you could say. But I made it to show what I was trying to ask and you just skip over it?!!!! I NEVER MIND!!! JavaScript answer my question by me doing the work, and the answer is yes, with a closure, you can skip over function, the function cannot touch the value(below it nor above it) of another function when you use a closure(unless design to).

  15. Unfortunately, my local network is having trouble with some internet resources and I can't see the images in your first post. In response to your second post... The people who manage the W3Schools website never visit the forums. When they update the website we are not notified of it. There are no contradictions, everything can be treated as an object in Javascript, even Strings and Numbers.Take this example for numbers: http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_valueof_numAnd this example for strings: http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_charat Variables are more complicated behind Javascript than what it appears to be in Javascript.A variable contains data, the amount of data that the variable contains depends on the type that the variable has. Some data types are not contained in the variable, but are referenced. That means that the variable is pointing to (or "referencing") another place that has data. Numbers and Booleans are contained inside the variable, but Strings, Arrays and Objects are not inside the variable. Javascript pretends that strings are inside the variable to make things easier.

    Your up earlier, unfortunately I can't comprehend this message right now as I been up as usually studying JavaScript. I'll come back to it a little later. Thanks for the reply, as always.And it's not your internet or browser, it this site, something wrong. A lot of feature are bugging I guess I could say.The picture is of the browser I use, with the console f12 open up. I wrote var obj = new Object(); in the console, with a couple of variables underneath it and link them to the obj and another value. As example: x = "y"; obj.x = "x"; more so as boj[x] = "y"; so when it log on screen, it'll show y instead of x as the variable... I think, or just the value y, but I know with the square bracket, it'll show the value as the variable being y.Any way, as I log in the console as so console.log(obj); it brought up the prototype with all it's property plus what I wrote, duo to the fact that I did not link it as so console.log(obj.y); to show case just one value.I'm going through the MDN guide.
  16. Y'ALL UPDATE THE SITE AND DON'T HAVE A THREAD ANNOUNCING SUCH THINGS!!!!!!!!!!!!!!!!!!!!!!------------------------------------Another post------------------------------------I HATE THE FACT THAT I CAN'T DELETE MY OWN THREADS!!!!!THIS IS A CONTRADICTION!!!Everything is an Object<~~~HERE A CONTRADICTION!In JavaScript almost everything is an object..<~~~HERE A CONTRADICTION!Even primitive data types (except null and undefined) can be treated as objects.•Booleans can be objects (or primitive data treated as objects)•Numbers can be objects (or primitive data treated as objects)<~~~HERE A CONTRADICTION!•Strings are also objects (or primitive data treated as objects)<~~~HERE A CONTRADICTION!•Dates are always objects•Maths and Regular Expressions are always objects•Arrays are always objects•Even functions are always objectsJavaScript ObjectsA JavaScript object is a complex variable, with properties and methods.The content of an object is composite: It can contain multiple property types (both primitive values and other objects).In JavaScript, all values except primitive values are objects.<~~~HERE A CONTRADICTION!Primitive values are: strings ("John Doe"), numbers (3.14), true, false, null, and undefined.---------------------------------Another post----------------------------------------Justsomeguy! To better explain it is to say variable are just reference to date value, they can grasp and hold a data value, there is not limit to the number of data they can hold except the 32bit room. But for such simple even a large complex program, if done right, can hold all data type.

  17. post-172009-0-20010800-1398324695_thumb.pngI'm believe this to be... or better yet, guess it to be the layout of a predefine object in JavaScript:post-172009-0-20010800-1398324695_thumb.png--------------------------------Another-post-----------------------------------Okay I see, this: post-172009-0-20010800-1398324695_thumb.png is the object structure. cause of the fact I log it in the console as just the object name, it brought back the object structure(knowing that structure is not the correct term(feel free tell me as I make a guess or memorize one)) the prototype I believe that... or better yet guess that to be. The inherent structure of the object from JavaScript's define object.
  18. My word... the answer is in the code!

    var pet = createPet("Vivie"); // this give me access to createPet scope and function we already knew that.pet.getName();                  // Viviepet.setName("Oliver");/* What I was asking is could I use that to alter it, and yes, but change this name to Oliver! But what I was asking again follow up to my post above this one, if this was a math method, than would it skip the function above it, the scope above it, so it want be affected, the value that is, want be affect by any other scope but the one below it, and even that, because it only say pet.setName(), does that mean also to that and function underneath it, again any scope underneath it can not again access to that function... if so, then this is a very power method. To gain access to different scope/method of a nested function. I hope this is more clearer, if not then don't worry about, I have to go off of what I feel is right for now, until clarity hit me of something different.Thank you all, I truly mean it.*/  pet.setSex("male");pet.getSex();                   // malepet.getName();                  // Oliver
    Sorry for the multiple post, it was not intended. If this sort of thing is not allow... which to my opinion is more or less as spamming, but please allow it, for each one of these are different, as a conversation between my self, and me wanted you to read how it went even know certain parts are not present.I'm seeing about a visualization of what I been trying to ask... But I also been trying to do that since some time close to the beginning of all of this... I think.Here:
    /*THIS IS WHAT I WAS TRYING TO ASK!!!! IT"S MY QUESTION BUT IN AN ANSWER FORM LIKE JEOPARDY!!!!!!! AAAAWWWWWWW CRAZY MONKEY TIME!!!!!!!! Techno beat.*/function mathWorkout(num){return{add : function(addNum){//addNum = numreturn(num+=addNum);},modulus : function(modNum){//modNum = num;return(num%=modNum);}, subtract : function(subNum){//subNum=num;return(subNum-=num);},divide : function(divNum/*, num*/){/*got it to over write num value, but if divide num                                      is NaN I want it to take on parent num value*///divNum = num;return(num/=divNum);}}} var math = mathWorkout(5);          // If there way only away to chagne the value in math.math.divide(3);                   /* here in math.divide, wait let me try tsomething OH                                     MY MIND I"M LOSING MY MIND AWWWWWWWWW! Techno-beat                                     But it'll be even better if I can chagne the value                                     in mathWorkout().... hold on. I... I'm                                         going pass my question... I should stop  here and                                      continue on with my studies (the me inside                                      of me feel back for doing this and not trying to f                                     igure out how this could be done)*//*math.add();math.subtract();math.divide();math.modulus();*/
  19. /* I want to try one more time, I was asking question on stockoverflow, but after three question, they banned me from asking anymore question cause the quality of the question is to low(said by them). If you know any other place I can go to, any other forums I can go to for more feed back, please share.*/ 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();                  // Viviepet.setName("Oliver");//pet.setSex("male");pet.getSex();                   // malepet.getName();                  // Oliver/*I was thinking of how to write this in a mathematic way, but can't fathom how.  My question is this:If this was a mathematic way, I could: var pet = createPet("Vivie"); change to var math = mathWorkout(5); //pet.getName(); change to math.InputValue(); // 5pet.setName("Oliver"); it'll be  math.add(); // math(num){var add=function(){return(num+=num)}}pet.setSex("male"); it'll be math.subtract();//var subtract=function(){return(num-=num);} Change value here and it want be will not be touch by above scope.pet.getSex(); change to math.addAnswer();// var addAnswer = function(){return(this=addAnswer);} pet.getName();change to math.subtractAnswer();// var subtractAnswer = function(){return(this=subtract);}// all of that is in the first funcation math(num){}... In away, this is all so beautiful....... Looking at it, the best way to really learn and get my question answer is to just play with it... but could you still try to answer my question please.
  20. It works because the function has access to the global scope, it's complicated to explain scope and you still don't understand enough about functions yet. If you think you're capable, you can read about scope here: http://javascriptplayground.com/blog/2012/04/javascript-variable-scope-this/

    Now that is way to advance for me, I'mma go back to developer MDN and keeping over the basic of JavaScript. But thinks any way.
  21. If you understood the definition properly you would have no problem distinguishing a recursive function from a non-recursive one. You don't actually understand the definition. Here's an example of a recursive function that doesn't have the name inside it:

    function factorial(n) {    if(n == 0 || n == 1) {        return 1;    } else {        return n * other(n - 1);    }}var other = factorial;alert( factorial(10) );
    You need to read about functions again. Read about them in the W3schools tutorial: Functions I and Functions IIRead carefully.

     

    function factorial(n) {    if(n == 0 || n == 1) {        return 1;    } else {        return n * other(n - 1);// That's crazy... I through no out side influence can happen in a function?!?!     }}var other = factorial; // So how is this possible?!?!?alert( factorial(10) );
  22. If you understood the definition properly you would have no problem distinguishing a recursive function from a non-recursive one. You don't actually understand the definition. Here's an example of a recursive function that doesn't have the name inside it:

    function factorial(n) {    if(n == 0 || n == 1) {        return 1;    } else {        return n * other(n - 1);    }}var other = factorial;alert( factorial(10) );
    You need to read about functions again. Read about them in the W3schools tutorial: Functions I and Functions IIRead carefully.

     

    I did as you said, and it made me went to go over the hold thing... as indicated in my signature which redirect you to my pic, I read over JavaScript tutorial two time, but due to thought roaming, I did not receive every thing I should or would have it if wasn't for my mind drifting off. THANK YOU! After I'm finishing going through developer MDN guide on JavaScript, I will return to either scheme through, or strictly parses through it for more refresh.It said you need an (function(){;})() around the code to evoke it self. Yours don't have that.
  23. The analogy they gave in college was a mailbox. A variable is a mailbox for a single piece of mail, with an address and everything. In lower-level languages like C, the actual variable only contains an address to memory, and the actual value is stored at that address.

    I like that better... but as it id describe, I think the octopus one is a little bit correct, please hear me out: Now the true meaning or job for a identifier(variable) is to grasp(I say grasp not from the book I gather this, but cause of the book and me comparing it to other different resource) the value, for when you define a value in the console, it life span only last for a short amount of time, after that, there no way to evoke that same value, so like two, if I just console.log(2); then, it'll show two on the console, but that... is just a photograph of two, for the real value of two is dead(meaning that it can't be evoke back)... I could say more but I think that's good enough... But I like yours analogy... so I'mma alter this concept for that concept, but also change yours up to better fit my look on it: ...(actually it's going to be very similar)... you know I like yours but as I think on it... grasping it make more since, like the variable put the value on life support, keeping the value a live with in it self... but your make since to say it in this way, a variable is just... let change it up, it's just a picture frame that holds a picture of the value, of how the value you, and what the value is, so every time the console see this picture frame with it's picture inside, it'll recreate an identical value... there is many ways of looking at it, but as long as one get an understanding of the two and their relation to the console, or environment they are present in.

    ...in Javascript, all functions are also objects. In fact, everything in Javascript is an object. Understanding objects is one of the basics you need to understand well in order to move on.I don't know what you're saying there, it's hard for me to understand you, but things like addition, subtraction, and multiplication are not scopes, they are operators. Functions are also not scopes, functions run in scopes. In Javascript you can also control which scope a function runs in when you call it, e.g.:

    var scope_object = {  name: 'Some Scope'};function some_function() {  alert(this.name); // "this" refers to the function's scope}some_function.call(scope_object); // alerts "Some Scope"

     

    like addition, subtraction, and multiplication are not scopes

    This:
    var num = function(x) {          // The outer function defines a variable called "x"      var add = function() {        return(x+=2);                // The inner function has access to the "x" variable of the outer function      }      return add;               // Return the inner function, thereby exposing it to outer scopes    },    dition = num(2);    dition();       // Returns 4
    like addition, subtraction, and multiplication are not scopesAnd... about the pet.name I'm just saying it was grasping the function it self by the function name.
  24. And I'm not talking about the definition, I'm talking about distinction of a recursive function from a regular function... You just gave me the definition, but I ask for how to tell it by looking at it, the definition, just tell it's functionality, but not how to identified it.How do you identified it:

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

    Is this is how you identified it? Yes, or no then so follow up feedback please.
  25. Nothing needs console.log. The console object and its methods are for debugging, they are not required for anything.I'm not sure what you mean by "contains the name", a recursive function is a function that calls (runs, executes, invokes, etc) itself. I don't know how to make that any more clear. Hopefully you understand what calling a function means. It does not mean naming a function.

    This is what I mean by contains the name:

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

×
×
  • Create New...