Jump to content

L8V2L

Members
  • Posts

    788
  • Joined

  • Last visited

Posts posted by L8V2L

  1. A property is like a variable, but it is a member of an object.

    I understand that, I'm speak on the array part. What does it mean by array?
  2. A method is a function that is a member of an object. A property is a value or set of values (in the form of an array or object) that is a member of an object.So this is stating that a method is a function belonging to a object(which I understand stand it's the second part that I need more clarity on) and a property is a value or set of value(in the form of an array or object) what do they mean by the second part?

  3. Anonymous Functions//An anonymous function is a function that was declared without any named identifier to refer to it. As such, an anonymous function is usually not accessible after its initial creation.//Anonymous function declarationvar anon = function() {    alert('I am anonymous');}; anon();
    // I understand how to declare an anonymous function.
    // The most common use for anonymous functions are as arguments to other functions, or as a closure.setTimeout(function() {    alert('hello');}, 1000); // Our anonymous function is passed to setTimeout, which will execute the function in 1000 milliseconds.
    I kinda(wounding mind a refresher on this) understand the anonymous function being use as an argument.
    (function() {    alert('foo');}()); // This is a common method of using an anonymous function as a closure which many javascript frameworks use.
    I'm lose... I don't understand this technique their using here.
      //Breakdown of the above anonymous statements://the surrounding braces is a wrapper for the anonymous function//the trailing braces initiates a call to the function and can contain arguments(function(message) {    alert(message);}('foo'));// Another way to write the previous example and get the same result/*An alternative representation of the above places the initiating braces to the surrounding braces and not the function itself, which causes confusion over why the surrounding braces are needed in the first place.*/
    What do they mean by wrapper.. and everything else!?!?
    (function() {    // ...})();Some have even resorted to giving the trailing braces technique derogatory names, in an effort to encourage people to move them back inside of the surrounding braces to where they initiate the function, instead of the surrounding braces.
    Please break it down for me to understand.
  4. Do you want us to assign you a problem to solve? Create some sort of form with appropriate validation code.

    Could you do that again please... But with question, basic question... Foundational JavaScript... sorry if I didn't show the appreciation toward the value of your action, but I need question that I can read and answer, for I'm going through tutorials to try to advance and strength the foundation I'm setting for myself. Such question as what is this, what does this function do, what is this function missing, what is the syntax for a literal array, what is the two ways beside literal to make an array, what is the three ways beside literal to make a function, etc. Could you do such post as this? Please... Could you considerate it... and anyone else who is reading this. Thank you, to those who took the time to read this.
  5. Prototype is a perfectly accurate term for what it is. A prototype is a model on which copies are based. My opinion about your learning of Javascript is that you're having trouble on your own, you need to sign up to a Javascript course to learn it properly and to have a tutor who can monitor your progress. You are learning things out of order and trying to understand advanced things without understanding the basics.

    Don't have the money for that... neither my mom, I wish not to trouble her... plus read signature which should direct you to somewhere. It's hard for me to learn in an open environment. Even with this, I get sidetrack like you want believe... I'm doing my best, with what I have to work with; a busted up laptop, and the web.
  6. Just look at what you posted:

    var foo = {name: "foo", zero: 0, one: 1};var bar = {one: "one", 1: 1};bar.__proto__ = foo; // this./*out put:[object Object]   {      [functions]: ,      1: 1,      __proto__: { },      name: "foo",      one: "one",      zero: 0   }*/
    The object foo has a property called name, with the value "foo". foo gets set as the prototype of the bar object. In the output of the bar object, you can see that now that object has a property called name, with the value "foo". It got copied from the prototype.Here's a question to see if you understand: in the output, there is a property called one that has the value "one". The prototype also has a property called one, why isn't the value in bar set to 1?

     

    I'm... happy not the word... excited... but calmly excited of this challenge, and wish you to do more as such in the near future despite my feedback.To answer your question... first it's a basic question. second, there's many ways to say it, it get's overshadow, overwritten. Or to go in detail, the interpreter check the prototype chain to see what property it need to copy from the object's prototype to the instance. If two properties are found in bock the instance and it's object prototype, than the instance property value's override the prototype's value. If just the name of the property, but not the actually value than I thought that the value of the prototype value will get transfer(but as I just try it didn't). I know their are different ways by my post of instancing an object from a object prototype. which is why I ask you to showcase and put a short description by them... or long which ever you want. I'll be thankful either way.
  7. Just my take on JavaScript... and etc... there are question I be asking which aren't question, but more of a... request of opinion/argument.MY OPEINION MATTER YOU DAM DIRTY APES... still haven't finish that movie: rise of the planet of the apes!!!!Okay my first opinion on JavaScript... in this thread a least:I feel as if... mind you, I'm not saying we should change it, but this to me better describe the relationship between the instance of the object's object prototype. with that said, instead of object prototype, it'll be better call object propagate(for the definition feature on http://dictionary.reference.com which state for the third definition: propagate-to transmit(hereditary features or elements)to, or through, offspring.)), instead of prototype, which mean model of for to from when reference to object's object prototype.Any opinions or and arguments?And please correct me on my term use!

  8. This output:output [object Array][Array[4], Array[4], Array[4], Array[4]]means that there is an array, which contains 4 arrays, and each of those arrays contains 4 elements.That's not a question, but inheritance is one of the major principles of object-oriented programming.http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)In languages that support inheritance, you can create one class that inherits everything from another class. Usually that is called extending. You might have a class that represents a vehicle in general. Then you create other classes that extend the vehicle class, such as a ground vehicle, air vehicle, water vehicle, etc. Then other classes that extend each of those, so a ground vehicle class might be extended by passenger vehicles, commercial vehicles, etc. Down to sedans, coupes, pickup trucks, motorcycles, etc, down to individual vehicles like a 2013 Mercedes C350. The class for that would inherit from every class that it extended, all the way up to the vehicle class. The vehicle class might define properties and methods that are common to all vehicles, like the current speed, direction, methods to start, stop, etc. Those properties and methods would be inherited by anything that extends the class, and each other class can also define their own properties and methods which would get inherited by any other class that extends it.Javascript is a prototype-based object-oriented language. Javascript does not have classes, it has prototypes instead. Instead of creating a new object of a certain class, instead you clone the prototype. Changing the prototype will affect every object that was created from it, all objects inherit the properties and methods of the prototype chain.http://en.wikipedia.org/wiki/Prototype-based_programming

    Thanks for the short explanation and the links. I read the introduction to the first one, but no more, since I'm concentrating on JavaScript.
    var foo = {name: "foo", zero: 0, one: 1};var bar = {one: "one", 1: 1};bar.__proto__ = foo; // this./*out put:[object Object]   {      [functions]: ,      1: 1,      __proto__: { },      name: "foo",      one: "one",      zero: 0   }*/var foo = {name:"foo", one: 3, two: 2};var bar = Object.create(foo); // this.bar.two ="two"; bar[2] = 2;console.log(bar);/*output:[object Object]   {      [functions]: ,      2: 2,      __proto__: { },      name: "foo",      one: 3,      two: "two"   }*/var foo = {name:"foo", four: 4, five: 5};var bar = foo; // this.bar.four ="four"; bar[5] = 5;console.log(bar);/*output:[object Object]   {      [functions]: ,      5: 5,      __proto__: { },      five: 5,      four: "four",      name: "foo"   }*//*Please explain the 'this.', which showcase the different of instance of an object(which to me is copying... or rather inheriting from another object(call the prototype object... or better term object prototype)). Yes, so what's the different in the instance display. and another that is not show case their but is similar in appearance is(var bar = foo()) and bar.[[prototype]] = foo. Please explain.*/ 
  9. I'm not sure what answer you're referring to. If this is what you're talking about:Then yes, each row is an array that contains other arrays.

    //The following code creates a two-dimensional array.var a = new Array(4);for (i = 0; i < 4; i++) {a[i] = new Array(4);for (j = 0; j < 4; j++) {a[i][j] = "[" + i + "," + j + "]";}}//This example creates an array with the following rows:Row 0: [0,0] [0,1] [0,2] [0,3]Row 1: [1,0] [1,1] [1,2] [1,3]Row 2: [2,0] [2,1] [2,2] [2,3]Row 3: [3,0] [3,1] [3,2] [3,3]//to my understanding an nested array is:var myarray=[[0,1][2,3]];//Looking at the ouput on the console again, I think I understand it:output [object Array][Array[4], Array[4], Array[4], Array[4]]
    I was speaking on the output. each array is an array that is in another away as a group. array a contain four arrays rows with four in each row.
    //as so:a=[0,0] [0,1] [0,2] [0,3][1,0] [1,1] [1,2] [1,3][2,0] [2,1] [2,2] [2,3][3,0] [3,1] [3,2] [3,3]]
    sorry I wasn't clear on my explanation.I have another question: Inheritance and the prototype chainI know that's a chapter of it's on. But if you could give me an short visual explanation, like you di with value and variable reference.<!--ignore-->
    /*//as invar 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 differentvar function e()*/
  10. It returns 20 because, apparently, in Javascript when you have a function where the parameters have the same name, the value of that variable is the value of the last parameter. I'm just guessing based on your results, because I've never tried to see what happens if you give all of the parameters the same name. Doing that doesn't make sense to me, there's no use for it.Your function gets called with these parameters:30, 20 -> return 40 (20 + 20)40, 10 -> return 20 (10 + 10)

    Yes, it seem that way. Doing it with the method reduce produce.
    10, 20->40 [20+20]40, 30->60 [30+30]
    Thanks for the clarity.
  11. //The following code creates a two-dimensional array.var a = new Array(4);for (i = 0; i < 4; i++) {a[i] = new Array(4);for (j = 0; j < 4; j++) {a[i][j] = "[" + i + "," + j + "]";}}//This example creates an array with the following rows:Row 0: [0,0] [0,1] [0,2] [0,3]Row 1: [1,0] [1,1] [1,2] [1,3]Row 2: [2,0] [2,1] [2,2] [2,3]Row 3: [3,0] [3,1] [3,2] [3,3]//to my understanding an nested array is:var myarray=[[0,1][2,3]];//Looking at the ouput on the console again, I think I understand it:// output [object Array][Array[4], Array[4], Array[4], Array[4]]// but would still like to have someone explain it.// even know I can now guess that each row is referring to an array in a array of arrays..// but still would like to have someone explain it... please.
  12. Thanks justsomeguy for the explanation above.

    var a = [10, 20, 30];var total = a.reduceRight(function(first, first) { return first + first; });console.log(total); // log 20 Why? I know it have something to do with the nming being    //the same, but the math ouput should not be 20.... How?    //I look at the reference page they had, and it seem to do what I expect it do.
  13. <xsl:for-each select="Item[ItemType='BOOK']">  <xsl:if test="position()=1">    <First_Book_Title>      <xsl:value-of select="Description"/>    </First_Book_Title>  </xsl:if></xsl:for-each>
    The trick was to search for all <Item> nodes that contain the ItemType of "BOOK". select="Item[itemType]='BOOK'] This will give you a list of Item nodes. From the returned list, we only want the first item, so we need to use the position() function. And there you have it! Simple and neat. (Although it did take a while to figure out :( )

     

    No :( face, :D. Puzzle solving is what programming is about... a least to me. rubes cube we stare at all day while we turn it in our head to find out what side go with what. I have stare at a screen thinking through with the knowledge my novice mind contain from studying to figure out what's wrong with a simple code, until I saw it was missing a ; or typo. You must consume yourself in the life of programming! Remember, the power is yours!(Captain Planet).

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

  15. why do the syntax look like this:

    if (condition)  statement_1[else  statement_2]//and not like this:if (condition)  satement_1else  satement_2
    What'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.
  16. 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

     

    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';  
×
×
  • Create New...