Jump to content

L8V2L

Members
  • Posts

    788
  • Joined

  • Last visited

Everything posted by L8V2L

  1. L8V2L

    Help!

    In the codes above, the name variable of the outer function is accessible to the inner functions, and there is no other way to access the inner variables except through the inner functions. The inner variables of the inner function act as safe stores for the inner functions. They hold "persistent", yet secure, data for the inner functions to work with. The functions do not even have to be assigned to a variable, or have a name.I see it as the inner functions act as a safe stores for the inner variables, than it being said above. This may not be a question, but it more important then that. this is speaking the concept to which one must grasp in order to completely understand JavaScript.my second argument is that the author made an typo for this is similar to writing a tongue twister... to me that is.
  2. L8V2L

    Help!

    why do the syntax look like this: if (condition) statement_1[else statement_2]//and not like this:if (condition) satement_1else satement_2What's the meaning of the []?It may not seem like a important question, but to understand the fact that one is looking for knowledge at the smallest detail, than just going off of consumption... well, if you can please answer.
  3. MUST LEARN JAVASCRIPT!!!!!

  4. L8V2L

    Help!

    It seem to me if it is a primitive value, then it'll just get copy, else if it otherwise; such as object, method, or and function they'll get reference. 'it seem to be if it is a primitive value,' ? 'then it'll be copy,' : 'else if other, it'll get reference';
  5. L8V2L

    Help!

    [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.
  6. L8V2L

    Help!

    ◦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!!!!!!!?????????
  7. L8V2L

    Help!

    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?
  8. L8V2L

    Help!

    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.
  9. L8V2L

    Help!

    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.
  10. L8V2L

    Help!

    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!
  11. L8V2L

    Help!

    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.
  12. L8V2L

    Help!

    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? 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
  13. L8V2L

    Help!

    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)
  14. L8V2L

    Help!

    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.
  15. L8V2L

    Help!

    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.
  16. L8V2L

    Help!

    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 stringNever 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.
  17. L8V2L

    Help!

    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...
  18. L8V2L

    Help!

    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).
  19. 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.
  20. 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.
  21. I'm believe this to be... or better yet, guess it to be the layout of a predefine object in JavaScript:--------------------------------Another-post-----------------------------------Okay I see, this: 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.
  22. L8V2L

    Help!

    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(); // OliverSorry 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();*/
  23. L8V2L

    Help!

    /* 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.
×
×
  • Create New...