
Web Front End-JavaScript Basic Tutorial
<script>has six properties:
async is valid for external scripts and can be used for asynchronous operations, downloading things without interfering with other operations.
charset specifies the character set for the src attribute.
defer indicates that the script is delayed until the document is parsed and displayed.
language is obsolete.
src means to execute an external file.
Typee denotes the type of scripting language used.
<script type="text/javascript" src="dashu.js"></script>
<script src="dashu.js"></script>
<head> <script></script> </head>
<body> <script></script> </body>
The script is deferred until the entire page has been parsed, without affecting the page structure:
<script defer="defer"></script>
The content type of the scripting language used by type to write code.
<script type="text/javascript"> function hello() { alert("hello"); } </script>
// Reference to external files <script type="text/javascript" src="example.js"></script>
defer means the script will be deferred until the entire page is loaded.
<!DOCTYPE html> <html> <head> <title></title> <script type="text/javascript" defer="defer" src=""></script> <script type="text/javascript" defer="defer" src=""></script> </head> <body> </body> </html>
Asynchronous scripts use async properties
<!DOCTYPE html> <html> <head> <title></title> <script type="text/javascript" async src=""></script> </head> <body> </body> </html>
xhtml Extensible Hypertext Markup Language
<script type="text/javascript"> function compare(a,b){ if(a<b){ }else{ } } </script>
<noscript>element, script is not supported by browser, script is supported by browser, but script is disabled.
<html> <head> <title></title> <script type="text/javascript" defer="defer" src=""></script> </head> <body> <noscript> <p>Browser Enablation Required javascript</p> </noscript> </body> </html>
javascript is used with <script>elements, external files are pointed to the corresponding files using src, <script>is parsed in turn according to their order on the page, defer attribute allows the current script not to wait for other scripts, use <noscript>elements to specify alternative content to display in browsers that do not support scripts.
Basic syntax, data type:



javascript is case sensitive, identifier, the first character is a letter, an underscore, or a dollar sign. Other characters can be letters, underscores, dollar signs, or numbers.
Keyword, reserved word, etc. cannot be used as an identifier.
Strict mode:
"use strict";
Keyword:
break,case,catch,continue,default,delete, do,else,finally,for,function,if,in, instanceof,new,return,switch,this,throw,try, typeof,var,void,while,with,
Reserved words:
abstract,enum,int,short, boolean,export,interfacee,static, byte,char,class,const,double, extends,final,float,goto,implements,import, interface,long,native,package,private,protected,public short,static,super,synchronized,throws,volatile
function test() { var msg = "hello"; // local variable } test(); function test() { msg = "hello"; // global variable } test();
Data type:
Undefined, null, boolean, number, string, object
undefined not defined;
Boolean boolean;
String string;
number value;
Object object or null;
Function is a function.
The type operator is used to determine the data type of a variable.
undefined type
var message; console.log(message == undefined); // true;
afterword
Okay, please leave a message in the message area to share your experience and experience.
Thank you for learning today. If you find this article helpful, you are welcome to share it with more friends. Thank you.
Introduction to the Author
Dashu, a man of science, author of short books & full stack engineer, writer with both sensibility and rationality, and individual independent developer, I believe you can too!Reading his articles is addictive!To help you become a better self.Long press the QR code below to watch. Welcome to share, it's a great place to top.
