12 Matching Annotations
  1. Jun 2022
    1. Several radio buttons can be tied together. If they share the same value for their name attribute, they will be considered to be in the same group of buttons.

      radio buttons need to share the same name to be considered part of the same group

    1. The value attribute is one which all <input>s share; however, it serves a special purpose for inputs of type checkbox: when a form is submitted, only checkboxes which are currently checked are submitted to the server, and the reported value is the value of the value attribute. If the value is not otherwise specified, it is the string on by default.

      I need to always add a "value" attribut to inputs like checkboxes or radio boxes!

    1. Symbols are an interesting twist on the idea of a string. The full explanation can be a bit long, but here’s the short version:Strings can be changed, so every time a string is used, Ruby has to store it in memory even if an existing string with the same value already exists. Symbols, on the other hand, are stored in memory only once, making them faster in certain situations.One common application where symbols are preferred over strings are the keys in hashes. We’ll cover this in detail in the hashes lesson later in the course.You won’t need to use symbols much in the beginning, but it’s good to get familiar with what they are and what they look like so that you can recognize them.

      symbols

    1. As a documentation convention, methods are listed out with either a :: or a # to indicate two different kinds of publicly accessible methods. Methods denoted by :: are considered class methods, while methods denoted by # are considered instance methods.

      In documentation (not actual code):

      :: -> class methods

      # -> instance methods

  2. May 2022
    1. So, to fix the issue with the phone codes, we can “cheat” by making the codes non-integer. Adding a plus "+" sign before each code is enough.

      how to sort integers by creation time in objets

    2. Square brackets also provide a way to obtain the property name as the result of any expression – as opposed to a literal string – like from a variable as follows:

      ```javascript let user = { name: "John", age: 30 };

      // get property values of the object: alert( user.name ); // John alert( user.age ); // 30 ```

      The above works. But if I want to ask the user to choose a value to show me about user, I can NOT use it like that. I have to use the "square brakets notation" and do something like this:

      ```javascript let key = prompt("What do you want to know about the user?", "name");

      // access by variable alert( user[key] ); // John (if enter "name") ```

    3. A property has a key (also known as “name” or “identifier”) before the colon ":" and a value to the right of it.

      let object = { key: value, }

      The "key:value" pair is called "property".

    1. There are three primary ways to go about this: you can attach functions’ attributes directly on your HTML elements, you can set the “on_event_” property on the DOM object in your JavaScript, or you can attach event listeners to the nodes in your JavaScript.

      How to make webpages dynamic with javascript

    2. Your JavaScript, for the most part, is run whenever the JS file is run, or when the script tag is encountered in the HTML. If you are including your JavaScript at the top of your file, many of these DOM manipulation methods will not work because the JS code is being run before the nodes are created in the DOM. The simplest way to fix this is to include your JavaScript at the bottom of your HTML file so that it gets run after the DOM nodes are parsed and created.

      Sometimes you want the javascript to run after, so make sure to add "defer" in the <script src"js-file.js" defer></script>

    3. document.createElement(tagName, [options]) creates a new element of tag type tagName.

      const div = document.createElement("div")

      that will NOT put the element in the DOM, it just creates the possibility of it. You gotta put it manually.

    4. It’s important to note that when using querySelectorAll, the return value is not an array. It looks like an array, and it somewhat acts like an array, but it’s really a “nodelist”. The big distinction is that several array methods are missing from nodelists. One solution, if problems arise, is to convert the nodelist into an array. You can do this with Array.from() or the spread operator.

      If you use "querySelectorAll", it doesn't return an array, but a nodelist, which means that you can't use all the array methods on the nodelist.

      But it's possible to convert the nodelist to an array if needed.