Skip to content

Instantly share code, notes, and snippets.

@FarhanMS123
Last active January 23, 2023 10:08
Show Gist options
  • Select an option

  • Save FarhanMS123/e752010feac2bfa31e39ff1d24e1b467 to your computer and use it in GitHub Desktop.

Select an option

Save FarhanMS123/e752010feac2bfa31e39ff1d24e1b467 to your computer and use it in GitHub Desktop.

Revisions

  1. FarhanMS123 revised this gist Jan 23, 2023. No changes.
  2. FarhanMS123 revised this gist Jan 23, 2023. 2 changed files with 48 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion ALGORITHM.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    # Algorithm

    ## List of Algorithm
    1. Range
    1. Range
    2. JS Notes
    46 changes: 46 additions & 0 deletions jsnotes.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    convert function to string via
    ```js
    function(){}.toString() or String(function(){})
    ```

    convert it back to Function via
    ```js
    Function("function(){}")
    ```

    there is a code such us this one :
    ```js
    var x = function(){}; x.a = "sample 1"; x.b = "sample 2";
    ```

    it will become :
    ```js
    {[Function], a:"sample 1", b:"sample 2"}
    ```
    you can get the Function via `String(x);`

    "arguments" variable in function is to get an arguments from calling a function
    ```js
    function x(a,b,c){console.log(arguments)}
    x("123", "abc", 555);
    ```
    output : `Arguments : ["123", "abc", 555]`

    ```js
    function y(){console.log(arguments)}
    y("123", "abc", 555);
    ```
    output : `Arguments : ["123", "abc", 555]`

    `function.apply(null, [])` is for call an arguments.
    ```js
    function x(a,b,c){console.log(`a:${a} || b:${b}`)}
    x.apply(null, ["123", "abc", 555]);
    ```
    output : `a:123 || b:abc`

    ```js
    function x(){console.log(arguments)}
    x.apply(null, ["123", "abc", 555]);
    ```
    output : `Arguments[3] : ["123", "abc", 555];`
  3. FarhanMS123 revised this gist Jan 23, 2023. 2 changed files with 30 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion ALGORITHM.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    # Algorithm

    ## List of Algorithm
    ## List of Algorithm
    1. Range
    28 changes: 28 additions & 0 deletions Range.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    Range is a way to decision a z-point from a-point to the b-point. <br />
    Example, we have 2 points. Point 20 and Point 70. <br />
    They have point from 20, 21, 22, 23, ..., 67, 68, 69, 70. <br />
    And not only that. They can have decimal value too, <br />
    such as 21.17453324, 21.17453325, 21.17453326, and so on. <br />

    so how we can got the x-point from 2 points? <br />
    like get percent value, it will solve with math. <br />
    lets say, we have 4 value. a, b, x, and v. <br />
    with `a=20, b=70, x=100, and v=60.` <br />
    a is the first value, b is the last value, x is the range from a to b, v is the point where we get, z is the point what we get. <br />
    in math, I use : <br />
    `a + v(b-a)/x = z` <br />
    why? when we want to get b from a, we should add a to (b-a) times v/x. if v same as x, then v/x= 1. so a+(b-a) = b. <br />
    1. ok lets we begin we the sample where v = 100;
    20 + (70-20)100/100=20+50=70
    2. v = 60
    20 + (70-20)60/100=20 + (50)60/100=50
    3. v = 40
    20 + (70-20)40/100=20 + (50)40/100=40
    4. v=50
    20 + (70-20)50/100=20 + (50)50/100=45

    Got it? <br />
    Well the function for now is <br />
    > a + v(b-a)/x = z
    so thank you for read this ^\_^
  4. FarhanMS123 created this gist Jan 23, 2023.
    3 changes: 3 additions & 0 deletions ALGORITHM.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    # Algorithm

    ## List of Algorithm