Home > Web Front-end > Front-end Q&A > Are method names in javascript case sensitive?

Are method names in javascript case sensitive?

WBOY
Release: 2022-02-14 17:05:53
Original
2624 people have browsed it

In JavaScript, method names are case-sensitive; JavaScript is a case-sensitive language. When entering language keywords, variables, function names, and all identifiers, they must be consistent. uppercase and lowercase forms.

Are method names in javascript case sensitive?

The operating environment of this tutorial: Windows 10 system, JavaScript version 1.8.5, Dell G3 computer.

Are method names in JavaScript case-sensitive?

are case-sensitive.

JavaScript is a literal scripting language. It is a dynamically typed, weakly typed, prototype-based language with built-in support for types. Its interpreter is called the JavaScript engine, which is part of the browser and is widely used in client-side scripting languages. It was first used on HTML (an application under Standard Universal Markup Language) web pages to add dynamic functions to HTML web pages. .

JavaScript is a case-sensitive language, which means that when entering language keywords, variables, function names, and all identifiers, you must adopt consistent character case.

For example, the keyword "while" must be entered as "while" and cannot be entered as "While" or "WHILE". The same is true for "online", "Online", "OnLine" and "ONLINE" " are four different variable names.

But be aware that HTML is not case-sensitive, which can be easily confused since it is closely related to client-side JavaScript. Many JavaScript objects and properties have the same names as the HTML tags and properties they represent.

In HTML these tags and property names can be entered in any case, but in JavaScript they are usually lowercase. For example, in HTML, the event handler property onclick is usually declared as onClick, but in JavaScript code only onclick can be used.

Variable names and function names in JS are case-sensitive

1. Variable names, for example:

var a = '1';
    alert(A);
Copy after login

This will cause the variable to be undefined.

2. Method name, for example:

function Hello(){
    alert("hello");
}
hello();
Copy after login

will report: Uncaught ReferenceError: hello is not defined, the method is not defined.

Summary: When writing function names and method names in JS, you need to pay attention to keeping the capitalization consistent.

Related recommendations: javascript learning tutorial

The above is the detailed content of Are method names in javascript case sensitive?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template