[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ru/docs/Learn_web_development/Howto/Solve_JavaScript_problems [Back]  [Original]

JavaScript- - - | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

JavaScript-

, , JavaScript .

In this article

/ , - , , , . .

, :

Correct Wrong
getElementsByTagName() getElementbyTagName()
getElementsByName() getElementByName()
getElementsByClassName() getElementByClassName()
getElementById() getElementsById()

/

, . :

Correct Wrong
elem.style.color = 'red'; elem.style.color = 'red;'

, .

- , .

:

js
function myFunction() {
  alert("This is my function.");
}

, ,

js
myFunction();

, functions have their own scope , , (. . - ), return the value .

, , JavaScript - return .

, (, Firefox) , return. Firefox .

- JavaScript, , :

js
var myNumber = 0;

Objects, - , , , , :

js
var myObject = {
  name: "Chris",
  age: 38,
};

Basic use cases

General

Variables

Math

Strings

Arrays

Debugging JavaScript

For more information on JavaScript debugging, see Handling common JavaScript problems; also see Other common errors for a description of common errors.

Making decisions in code

Looping/iteration

Intermediate use cases

Functions

Objects

JSON

Events

Object-oriented JavaScript

Web APIs


Web Proxy Viewer  |  New URL  |  Original Page