JavaScript The Language(Not Node.js)

G4143

Registered Member
Joined
Jan 16, 2019
Messages
68
Reaction score
31
I'm looking for a good (and hopefully complete) tutorial of the browser based JavaScript language. I'm not looking for how the JavaScript language interfaces with an HTML page but the language proper. Basically objects, arrays, dictionaries, higher level functions, variables, looping constructs, etc.
 
to learn?

https://www.w3schools.com/js/

where most learn above.

we use the javascript manual as well to look deeper.

https://developer.mozilla.org/bm/docs/Web/JavaScript/Guide

for more help join a javascript forum

gd luck

ps.

your need to learn also

javascript
ajax part of javascript.
HTML and html5

there all together

bootstrap

it a very long adventure because you update your self as time goes on, there no end point of learning..

best to master the basics

you can get self teach book and learn in 24 hours , it all bullshit , i been using javascript / ajax over 14 years and still learning daily, it a lifetime hell.

my advise learn the code and it meaning dont be a copy and paste programmer study hard .

when you no the code then copy and paste fully allowed becouse you no it meaning .

notepad 2 perfect to code with .
 
Last edited by a moderator:
to learn?
Well to learn the JavaScript language without all the HTML examples which distract from the main goal.

Note: I have some experience in several languages like Perl, C, C++, OCaml, etc. So I don't need a NOOBS tutorial but a concise tutorial of the language would be nice.
 
Been playing with JavaScript and I'm really impressed how it implements higher order functions and I'm also surprised that most editors allow the programmer to write and execute JavaScript without any HTML. Some messy code I was playing with... A very simple Trie.
Code:
"use strict";

function None() {
    this.isSome = false;
    this.bindIt = function (func) { return this; };
}

function Some(pData) {
    this.data = pData;
    this.isSome = true;
    this.bindIt = function (func) { return func(this.data); };
}

const none = new None();

function FirstRemainder(first, remainder) {
    this.First = first;
    this.Remainder = remainder;
}

function getFirstChars(str) {
    let len = str.length;
    if (len > 1) {
        return new Some(new FirstRemainder(str.charAt(0), str.slice(1)));
    } else if (len === 1) {
        return new Some(new FirstRemainder(str.charAt(0), ''));
    } else {
        return none;
    }
}

function add(trie, str) {
    let chars = getFirstChars(str);

    if (chars.isSome) {
        if ((chars.bindIt(function (d) { return d.First; })) in trie) {
            add(trie[chars.bindIt(function (d) { return d.First })], chars.bindIt(function (d) { return d.Remainder }));
        } else {
            let newTrie = {};
            trie[chars.bindIt(function (d) { return d.First })] = newTrie;
            add(newTrie, chars.bindIt(function (d) { return d.Remainder }));
        }
    } else {
        return trie;//don't need this
    }
}

function find(trie, str) {
    let chars = getFirstChars(str);

    if (chars.isSome) {
        if ((chars.bindIt(function (d) { return d.First; })) in trie) {
            return find(trie[chars.bindIt(function (d) { return d.First })], chars.bindIt(function (d) { return d.Remainder }));
        } else {
            return none;
        }
    } else {
        return new Some(trie);
    }
}

function display(trie) {
    for (let c in trie) {
        console.log(c);
        display(trie[c]);
    }
}

function strings(trie) {
    let arr = [];

    function stringsAux(trie, strs) {
        for (let c in trie) {
            stringsAux(trie[c], strs + c);
        }
        if (Object.keys(trie).length === 0) {
            arr.push(strs);
            strs = "";
        }
    }

    stringsAux(trie, "");
    return arr;
}

let trie = {};

add(trie, "G4143\n");
add(trie, "This is the first\n");
add(trie, "This is the second\n");
add(trie, "This is the third\n");
add(trie, "This is the fourth\n");
add(trie, "This is the fourth\n");
add(trie, "Here it ends...\n");
//try duplicates
add(trie, "G4143\n");
add(trie, "This is the first\n");
add(trie, "This is the second\n");
add(trie, "This is the third\n");
add(trie, "This is the fourth\n");
add(trie, "This is the fourth\n");
add(trie, "Here it ends...\n");

let ans = find(trie, "This is the ");

if (ans.isSome) {
    ans.bindIt(function (d) { display(d) });
} else {
    console.log("Nothing found!");
}

console.log("Lines...");

let strs = strings(trie);

for (let line in strs) {
    console.log(`Line: ${strs[line]}`);
}

//display data structure

console.log(JSON.stringify(trie));
 
Last edited:
This is a course that has been recommended time and time again to understand the beauty of javascript.
https://www.udemy.com/understand-javascript/

You can find it on torrents if you don't want to buy.
Edit: Check this youtube channel as well.

I always heard JavaScript was a mess of a language(one of the reasons I shied away from it) but after reading some introductory text and playing around with it, I have to say its not that bad when you accept its odd object model(well odd for someone who was introduced to OOP with C++).
 
Yes! This language(when you get some of the basics down) is fun to program in and its easy to implement abstractions in. I see why people like this language.
Code:
"use strict";

function crtNone () {
    class None {
        constructor() {
            this.isSome = false;
            this.bindIt = function (func) {return this;};
        }
    }
    return Object.freeze(new None());
}

function crtSome (pData) {
    class Some {
        constructor (pData) {
            this.data = pData;
            this.isSome = true;
            this.bindIt = function (func) {return func(this.data);};
        }
    }
    return Object.freeze(new Some(pData));
}

const none = crtNone();

function crtFirstRemainder (first, remainder) {
    class FirstRemainder {
        constructor (first, remainder) {
            this.First = first;
            this.Remainder = remainder;
        }
    }
    return Object.freeze(new FirstRemainder(first, remainder));
}

function getFirstChars (str) {
    let len = str.length;

    if (len > 1) {
        return crtSome(crtFirstRemainder(str.charAt(0), str.slice(1)));
    }else if (len === 1) {
        return crtSome(crtFirstRemainder(str.charAt(0), ''));
    }else {
        return none;
    }
}

const trie = {};

function add (trie, str) {
    const chars = getFirstChars(str);

    if (chars.isSome) {
        const first = chars.bindIt(d => d.First);
        const remainder = chars.bindIt(d => d.Remainder);
        if ((first) in trie) {
            add(trie[first], remainder);
        }else {
            let newTrie = {};
            trie[first] = newTrie;
            add(newTrie, remainder);
        }
    }
}

function display (trie) {
    for (let elem in trie) {
        console.log(elem);
        display(trie[elem]);
    }
}

function find(trie, str) {
    const chars = getFirstChars(str);

    if (chars.isSome) {
        const first = chars.bindIt(d => d.First);
        const remainder = chars.bindIt(d => d.Remainder);
        if ((first) in trie) {
            return find(trie[first], remainder);
        }else {
            return crtNone();
        }
    }else {
        return crtSome(trie);
    }
}

function strings (trie) {
    let arr = [];

    function strAux (trie, str) {
        for (const elem in trie) {
            strAux(trie[elem], str + elem);
        }
        if (Object.keys(trie).length === 0) {
            arr.push(str);
        }
    }

    strAux(trie, "");
    return arr;
}

add (trie, "G4143\n");
add (trie, "This is the first\n");
add (trie, "This is the second\n");
add (trie, "This is the third\n");
add (trie, "This is the fourth\n");
add (trie, "Good job getting here\n");
add (trie, "Here it ends...\n");


console.log(trie);

display(trie);

const ans = find(trie, "This is the ");

console.log(`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`);

if (ans.isSome) {
    ans.bindIt(d => display(d));
}else {
    console.log("Ooops. Didn't find anything!");
}

console.log(`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`);

const sArr = strings(trie);

for (const i in sArr) {
    console.log(sArr[i]);
}
 
Take a look at javascript path on pluralsight. Their monthly subscription is of 25$ ( I may be wrong ), but you can access a wide variety of tutorials of all programming languages.
 
Team Treehouse and PluralSight are two of my favorite learning resources. I've been writing JavaScript for some 17 years, and as a member on these sites, I've checked out their JavaScript content from time to time (or due to it being prerequisites for others). And I've been happy with both. Easy to understand, but not so simple as to forego details where necessary.

And it was linked above, but keep the MDN bookmarked. It is the bible of JavaScript web development.
 
You can get PluralSight for free through Microsoft

https://docs.microsoft.com/en-us/visualstudio/subscriptions/vs-pluralsight
Thank you so much, man! works, even if it's just for a month, it's more than welcome. I guess I'll be checking out which tuts are useful and downloading them. Thanks again!
 
Back
Top