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

Solve common problems in your JavaScript code - Web | 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

Solve common problems in your JavaScript code

JavaScript .

In this article

undefined , .

.

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

. :

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

.

. :

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

.

js
myFunction();

. (, )

, JavaScript . .

, (Firefox ) . Firefox "unreachable code after return statement" .

vs

, . :

js
const myNumber = 0;

, . , , :

js
const 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(en-US); 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