GithubHelp home page GithubHelp logo

javascript-tutorial / en.javascript.info Goto Github PK

View Code? Open in Web Editor NEW
22.7K 339.0 3.8K 745.27 MB

Modern JavaScript Tutorial

Home Page: https://javascript.info

License: Other

HTML 88.48% JavaScript 8.67% CSS 2.82% PHP 0.03%
english javascript tutorial

en.javascript.info's Introduction

The Modern JavaScript Tutorial

This repository hosts the English content of the Modern JavaScript Tutorial, published at https://javascript.info.

Translations

We'd like to make the tutorial available in many languages. Please help us to translate.

See https://javascript.info/translate for the details.

Contributions

We'd also like to collaborate on the tutorial with other people.

Something's wrong? A topic is missing? Explain it to people, add it as PR 👏

You can edit the text in any editor. The tutorial uses an enhanced "markdown" format, easy to grasp. And if you want to see how it looks on-site, there's a server to run the tutorial locally at https://github.com/javascript-tutorial/server.

The list of contributors is available at https://javascript.info/about#contributors.

Structure

Every chapter, article, or task has its folder.

The folder is named like N-url, where N is a number for the sorting purposes and URL is the URL part with the title of the material.

The type of the material is defined by the file inside the folder:

  • index.md stands for a chapter
  • article.md stands for an article
  • task.md stands for a task (solution must be provided in solution.md file as well)

Each of these files starts from the # Main header.

It's very easy to add something new.



Ilya Kantor @iliakan

en.javascript.info's People

Contributors

aniketkudale avatar aruseni avatar bezart avatar brentguf avatar cpxpratik avatar dagolinuxoid avatar darryl1702 avatar hadrysmateusz avatar hrodward avatar iliakan avatar imidom avatar jchue avatar joaquinelio avatar k-sato1995 avatar l1un avatar leviding avatar lex111 avatar lumosmind avatar maurodibert avatar paroche avatar peachesontour avatar rnbsov avatar romchik avatar simmayor avatar smith558 avatar tonchique avatar usernamehw avatar violet-bora-lee avatar vsemozhetbyt avatar zyinmd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

en.javascript.info's Issues

508 section for event.preventDefault

Without changing what you have, I would put a note about how preventing the default behavior of an anchor or submit button changes its intention and is therefore, no longer semantic and 508 compliant. So, anchors navigate to parts of pages or external pages, buttons perform actions and submit buttons submit forms. If you are doing anything else with these elements you should consider using another element.

Optional dark theme

Many users like it, many users need it because of sensitive eyes, bad displays, low light conditions. This is called accessibility.

Also, MDN is white only - so dark theme will be your competitive adventure :)

Keyboard shortcut for back button

For Chrome and FF on Windows:

  1. Click a title to go to a section.
  2. Hit alt-left arrow to back to the previous page.
  3. You end up at the previous chapter instead.

Hitting the back button works, but the keyboard shortcut for the back button does not.

consistency in tutorials

the first link i clicked on this tutorial landed me here:

double quotes, single quotes, bracket spacing, no bracket spacing.

If you're trying to teach people to learn a language you need to remain consistent. Possibly eslint your example code to make sure you keep a standard around or people will come out of the tutorial doing the same thing.

In section: "Classes" after subsection: "Getters/setters" in line 5 of code

In the constructor change this._name = name; into this.name = name; or as it is the code will not do what it is intended to do.

The final code should be:

class User {
  constructor(value) {
    // invokes the setter
    this.name = value;
  }

  get name() {
    return this._name;
  }

  set name(value) {
    if (value.length < 4) {
      alert("Name too short.");
      return;
    }
    this._name = value;
  }
}

Suggestion: Add some collaborators for PRs

It's just a suggestion based on what I saw during this month. I saw so many simple PRs which fix a typo waited almost weeks to merge.
I think adding some active collaborators if you're busy most of the time should be a useful thing because most of PRs are just fixing typos. For start I want to be one if you wish.
And I must thank you @iliakan for all your amazing works on this 👍

mentioning strict mode

Function in if

let phrase = "Hello";

if (true) {
  let user = "John";

  function sayHi() {
    alert(`${phrase}, ${user}`);
  }
}

sayHi();

The result is an error.

The function sayHi is declared inside the if, so it only lives inside it. There is no sayHi outside.

When I execute the code I don't get any error unless in strict mode, I think it can be a good idea to remind others that in order to see the error we need to add `'use strict';' at the top of our code

'Edit on Github' in new tab?

More of a suggestion than an issue but wouldn't it be more intuitive to have Github open in a new tab to edit? (I'm talking about the link in the bottom-left corner)

Invite proofreaders (contributors) to this project

The recent significant increase in this project's popularity and the backlog seem to indicate that this project could use more proofreaders.

I'm willing to volunteer. I'm an instructor with a code school and I already have my students using this. So I'd like to help out in a few areas where I can.

More A Question Than An Issue Really - An Observation To Be Correctly - Iliakan, Please Explain

@iliakan thanks for creating this site; it is really helpful to my learning js.

I'm not able to use Disqus comments at javascript.info and so I'm placing here mostly a question (it might turn out into an issue or perhaps a PR if you decide so which I'm not sure how to handle yet; my apologies). I'm really trying to understand the tutorial and 'playing around' with the code to grasp it. So please let me know how you want me to place future questions of this sort on javascript-tutorial-en.

So here is my question:
In the Drag'n'Drop with mouse events section in the very first and in the very last examples the code includes this one:

...
document.body.append(ball);
...

It seems to me that this line is redundant. After all ball is the id to one of the only two div's and so it is already part of the body hence it does not need any further appending. In my editor when I remove the above line i do not observe any difference in drag-n-drop behaviour of the ball. Let me know if I am not understanding anything. Thanks.

Making awesome videos for tutorials

I'm interested in making video tutorials based on each articles in javascript.info
If you don't have a problem with this, I can start making and then put them in article pages for better learning quality and also on YouTube for advertising the javascript.info site itself.
(I can take a test video for you if you wish)

Portuguese Translation

Opening this issue to inform I'll start translating it to pt-BR.
If someone want to help, PR my repo.

Offering to copyedit entire tutorial

@iliakan thanks for accepting my recent grammar/usage/punctuation pull request. If you'd like, I could review and edit the entire tutorial. With the little time I have available outside of work, I could probably complete the task in about four weeks. I just wanted to check with you to make sure this is something you are looking for, before I commit to the task. I suspect that this is something you'd be open to, considering the header on the tutorial pages explicitly requesting help with editing :)

I am a newbie coder just looking to get involved in a project somehow. As I mentioned in my pull request, my focus would only be grammar, word usage, and punctuation. I wouldn't be editing any sections of code (unless I was very confident an error existed), and I wouldn't seek to edit any of the text's style or meaning.

Let me know what you think. Cheers!

Do not break line on inline code

I think it would be better to keep inline code together:
broken
Will this break something in the tutorial?

.main code {
    white-space: pre;
}

glued

Bug and a solution to "Mouse events basics" section and "Selectable list" task

Hello Ilaya and thank you very much for you fantastic work on
javascript.info and your positive impact on my learning javascript
and web development. Truly, your site is the very best from what I have seen
till now. My hope is that you will continue with this wonderful project into
the future.
Below I'm suggesting a correction to the task. In Mouse events basics section
and Selectable list task your solution has a bug. The bug: using Ctrl first
select few lines; next release Ctrl and select/unselect one line. Now you
should see what is happening: the lines are not unselected the same way as you
are clicking.
May I suggest this solution, which to my best knowledge is working very well (the head and body are same/unchanged):

  <script>
    ul.onmousedown = function(event)
    {
      return false;
    }
    ul.onclick = function(event)
    {
      if (event.ctrlKey)
      {
        event.target.classList.toggle('selected');
      }
      else
      {
        for (let li of ul.querySelectorAll('li'))
        {
          li.classList.remove('selected');
        }
        event.target.classList.add('selected');
      }
    }
  </script>

PS: I've posted this comment on Disqus site gives me terrible problems e.g. my comments don't show up on javascript.info. Also I cannot follow over people comments on Disqus. I've checked my settings with Disqus, but it's simply not working well. Hence, I'm double posting it this time. Other than that: thank you Ilaya for
javascript.info

PSS: Just to let you know that I've placed earlier 9 comments in Disqus (on javascript.info) but not even one has appeared on Disqus.

line 104

On line 104 is the following: "...don't let the visitor to interact..."

should either be "...don't let the visitor interact..."

or

"don't allow the visitor to interact."

What is the licence of the tutorial?

Hello,

I am considering to translate the tutorial in french, but I can't find a licence file in the main repo.
What is the licence of the tutorial?

Thank you for your work !

Is it possible to highlight inline code?

I guess it would be easier to read the chapters if the inline code was highlighted, especially for: numbers, booleans, operators and keywords

  • It will help distinct inline string from value (and many others potential mistakes):
true "true"
  • Remove unnecessary quotes in some places like:

A regular equality check "==" has a problem

  • Distinct resembling entities:
false falsy
  • Make the entire tutorial more of the same style.

Before:

not much
After:

better

problem in mobile view

the java script fundamental's items in the desktop view are not exactly the same as the items in the mobile view

Wrong solution for http://javascript.info/closure#function-in-if

The solution for the task "Function in if" under "closures" chapter is incorrect. It does not give error and alerts "Hello, John".
The explanation with correct solution should explain "hoisting" of function declarations. In the example we are using function declaration for the function "sayHi", which roughly translates to
`let phrase = "Hello";

if (true) {
let user = "John";

var sayHi = function () {
alert(${phrase}, ${user});
}
}

sayHi();`

(This translation is just to explain the code here, I am aware function declaration and expression are different things)
Now since "var" is not bound with block scope of "if", it will be accessible outside and so we get the alert.

You can add this to explain it more clearly
`let phrase = "Hello";

if (true) {
let user = "John";

let sayHi = function () {
alert(${phrase}, ${user});
}
}

sayHi();`

Here we are using "let" and that is bound in the block scope of "if", so it is not accessible outside and will throw a referenceError.

P.S. - I am a fan of content and flow of javascript.info since a long time and you are doing a terrific job. Kudos.

Suggestion: export as epub/mobi

I think it would be great if the tutorial could be exported in the epub or mobi format through the website. Has there been any attempts or thoughts about doing this earlier?

language inconsistency

There was language inconsistency in helper-like info, tooltips. they are in I-don't-even know what language it is haha..

I found it on, close button in solution in tasks, and in popup alert like in bootstrap component.

Use code playgrounds

First, thank you for this awesome tutorial.

For Tasks section, how about add online code playground, like jsbin, codepen, jsfidle, plunker etc ?

Sorry, my bad

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.