Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

Unión de líneas

1
2 <!DOCTYPE html>
3 <html lang="en-US">
4 <head>
5 <title>JavaScript Syntax</title>
6 <meta charset="utf-8">
7 <meta name="viewport" content="width=device-width, initial-scale=1">
8 <meta name="Keywords" content="HTML, Python, CSS, SQL, JavaScript, How to, PHP, Java, C, C++, C#, jQuery, Bootstrap, Colors, W3.CSS, XML, MySQL, Icons, N
9 <meta name="Description" content="Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript,
10 <meta property="og:image" content="https://www.w3schools.com/images/w3schools_logo_436_2.png">
11 <meta property="og:image:type" content="image/png">
12 <meta property="og:image:width" content="436">
13 <meta property="og:image:height" content="228">
14 <meta property="og:description" content="W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering
15 <link rel="icon" href="/favicon.ico" type="image/x-icon">
16 <link rel="preload" href="/lib/fonts/fontawesome.woff2?14663396" as="font" type="font/woff2" crossorigin>
17 <link rel="preload" href="/lib/fonts/source-code-pro-v14-latin-regular.woff2" as="font" type="font/woff2" crossorigin>
18 <link rel="preload" href="/lib/fonts/roboto-mono-v13-latin-500.woff2" as="font" type="font/woff2" crossorigin>
19 <link rel="preload" href="/lib/fonts/source-sans-pro-v14-latin-700.woff2" as="font" type="font/woff2" crossorigin>
20 <link rel="preload" href="/lib/fonts/source-sans-pro-v14-latin-600.woff2" as="font" type="font/woff2" crossorigin>
21 <link rel="preload" href="/lib/fonts/freckle-face-v9-latin-regular.woff2" as="font" type="font/woff2" crossorigin>
22 <link rel="stylesheet" href="/lib/w3schools31.css">
23
24 <!-- Google Tag Manager -->
25 <script>
26 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
27 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
28 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
29 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
30 })(window,document,'script','dataLayer','GTM-KTCFC3S');
31
32 var subjectFolder = location.pathname;
33 subjectFolder = subjectFolder.replace("/", "");
34 if (subjectFolder.startsWith("python/") == true ) {
35 if (subjectFolder.includes("/numpy/") == true ) {
36 subjectFolder = "numpy/"
37 } else if (subjectFolder.includes("/pandas/") == true ) {
38 subjectFolder = "pandas/"
39 } else if (subjectFolder.includes("/scipy/") == true ) {
40 subjectFolder = "scipy/"
41 }
42 }
43 subjectFolder = subjectFolder.substr(0, subjectFolder.indexOf("/"));
44 </script>
45 <!-- End Google Tag Manager -->
46
47 <script src="/lib/uic.js?v=1.0.5"></script>
48 <script data-cfasync="false" type="text/javascript">
49 var k42 = false;
50
51 k42 = true;
52
53 </script>
54 <script data-cfasync="false" type="text/javascript">
55 window.snigelPubConf = {
56 "adengine": {
57
58 "activeAdUnits": ["main_leaderboard", "sidebar_top", "bottom_left", "bottom_right"]
59
60 }
61 }
62 uic_r_a()
63 </script>
64 <script async data-cfasync="false" src="https://cdn.snigelweb.com/adengine/w3schools.com/loader.js" type="text/javascript"></script>
65 <script src="/lib/common-deps.js?v=1.0.1"></script>
66 <script src="/lib/user-session.js?v=1.0.28"></script>
67 <script src="/lib/my-learning.js?v=1.0.19"></script>
68 <script type='text/javascript'>
69 var stickyadstatus = "";
70 function fix_stickyad() {
71 document.getElementById("stickypos").style.position = "sticky";
72 var elem = document.getElementById("stickyadcontainer");
73 if (!elem) {return false;}
74 if (document.getElementById("skyscraper")) {
75 var skyWidth = Number(w3_getStyleValue(document.getElementById("skyscraper"), "width").replace("px", ""));
76 }
77 else {
78 var skyWidth = Number(w3_getStyleValue(document.getElementById("right"), "width").replace("px", ""));
79 }
80 elem.style.width = skyWidth + "px";
81 if (window.innerWidth <= 992) {
82 elem.style.position = "";
83 elem.style.top = stickypos + "px";
84 return false;
85 }
86 var stickypos = document.getElementById("stickypos").offsetTop;
87 var docTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
88 var adHeight = Number(w3_getStyleValue(elem, "height").replace("px", ""));
89 if (stickyadstatus == "") {
90 if ((stickypos - docTop) < 60) {
91 elem.style.position = "fixed";
92 elem.style.top = "60px";
93 stickyadstatus = "sticky";
94 document.getElementById("stickypos").style.position = "sticky";
95
96 }
97 } else {
98 if ((docTop + 60) - stickypos < 0) {
99 elem.style.position = "";
100 elem.style.top = stickypos + "px";
101 stickyadstatus = "";
102 document.getElementById("stickypos").style.position = "static";
103 }
104 }
105 if (stickyadstatus == "sticky") {
106 if ((docTop + adHeight + 60) > document.getElementById("footer").offsetTop) {
107 elem.style.position = "absolute";
108 elem.style.top = (document.getElementById("footer").offsetTop - adHeight) + "px";
109 document.getElementById("stickypos").style.position = "static";
110 } else {
111 elem.style.position = "fixed";
112 elem.style.top = "60px";
113 stickyadstatus = "sticky";
114 document.getElementById("stickypos").style.position = "sticky";
115 }
116 }
117 }
118 function w3_getStyleValue(elmnt,style) {
119 if (window.getComputedStyle) {
120 return window.getComputedStyle(elmnt,null).getPropertyValue(style);
121 } else {
122 return elmnt.currentStyle[style];
123 }
124 }
125 </script>
126
127 </head><body>
128 <!-- Google Tag Manager (noscript) -->
129 <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KTCFC3S"
130 height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
131 <!-- End Google Tag Manager (noscript) -->
132 <style>
133 #darkmodemenu {
134 position:absolute;
135 top:-40px;
136 right:16px;
137 padding:5px 20px 10px 18px;
138 border-bottom-left-radius:5px;
139 border-bottom-right-radius:5px;
140 z-index:-1;
141 transition: top 0.2s;
142 user-select: none;
143 }
144 #darkmodemenu input,#darkmodemenu label {
145 cursor:pointer;
146 }
147 </style>
148 <script>
149 (
150 function setThemeMode() {
151 var x = localStorage.getItem("preferredmode");
152 var y = localStorage.getItem("preferredpagemode");
153 if (x == "dark") {
154 document.body.className += " darktheme";
155 }
156 if (y == "dark") {
157 document.body.className += " darkpagetheme";
158 }
159 })();
160 </script>
161 <div id="pagetop" class="w3-bar w3-card-2 notranslate">
162 <a href="https://www.w3schools.com" class="w3-bar-item w3-button w3-hover-none w3-left w3-padding-16" title="Home" style="width:77px">
163 <i class="fa fa-logo ws-text-green ws-hover-text-green" style="position:relative;font-size:42px!important;"></i>
164 </a>
165
166 <style>
167 .topnavmain_pro {
168 background-color:#9763f6;
169 color:#fff;
170 }
171 .topnavmain_pro:hover {
172 background-color:#7d53cc!important;
173 color:#fff!important;
174 }
175
176 @media screen and (max-width: 1160px) {
177 .ws-hide-1160 {
178 display: none !important;
179 }
180 }
181 @media screen and (max-width: 1300px) {
182 .ws-hide-1300 {
183 display: none !important;
184 }
185 }
186 @media screen and (max-width: 700px) {
187 .ws-hide-700 {
188 display: none !important;
189 }
190 }
191 @media screen and (max-width:380px) {
192 #w3loginbtn {
193 width:90px!important;
194 padding-left:2px!important;
195 padding-right:2px;
196 }
197 #signupbtn_topnav,#spacesbtn_topnav {
198 display:none!important;
199 }
200 }
201
202 </style>
203
204 <a class="w3-bar-item w3-button w3-hide-small barex bar-item-hover w3-padding-24" href="javascript:void(0)" onclick="w3_open_nav('tutorials')" id="navb
205 <a class="w3-bar-item w3-button w3-hide-small barex bar-item-hover w3-padding-24" href="javascript:void(0)" onclick="w3_open_nav('references')" id="nav
206 <a class="w3-bar-item w3-button w3-hide-small barex bar-item-hover w3-padding-24 ws-hide-800" href="javascript:void(0)" onclick="w3_open_nav('exercises
207
208 <a class="w3-bar-item w3-button bar-item-hover w3-padding-24 barex ws-hide-1300" href="/bootcamp/index.php" title="Web Development Bootcamp">Bootcamp</
209
210 <a class="w3-bar-item w3-button bar-item-hover w3-padding-24" href="javascript:void(0)" onclick="w3_open()" id="navbtn_menu" title="Menu" style="width:
211
212 <div id="loginactioncontainer" class="w3-right w3-padding-16" style="margin-left:1px;width:55px">
213 <div id="mypagediv"></div>
214 <!-- <button id="w3loginbtn" style="border:none;display:none;cursor:pointer" class="login w3-right w3-hover-greener" onclick='w3_open_nav("login")'
215 <a id="w3loginbtn" title="Login to your account" class="w3-bar-item w3-btn bar-item-hover w3-right ws-light-green" style="display:none;width:112px;
216 </div>
217
218 <div class="w3-right w3-padding-16">
219 <a id="spacesbtn_topnav" style="display:none;width: 93px;border-radius: 25px; margin-right: 20px;" class="w3-bar-item w3-button w3-right w3x-hide-sma
220 <a id="signupbtn_topnav" class="w3-bar-item w3-button w3-right barex ws-green ws-hover-green" style="width: 93px;border-radius: 25px; margin-right: 2
221 <a class="w3-bar-item w3-button w3-right ws-hide-1066 w3-hide-small barex ws-yellow ws-hover-yellow gt-btn-top-spaces" style="width: 150px;border-rad
222 <a class="w3-bar-item w3-button w3-right ws-hide-900 w3-hide-small barex ws-pink ws-hover-pink gt-btn-top-cert" style="border-radius: 25px; margin-ri
223 <a class="w3-bar-item w3-button w3-right w3-hide-small ws-hide-1160 barex topnavmain_pro gt-btn-top-pro" style="border-radius: 25px; margin-right: 15
224 <!-- <a class="ws-light-green ws-hover-green w3-bar-item w3-button w3-right w3-hide-small ws-hide-1300 barex" style="border-radius: 25px; margin-right
225 </div>
226 </div>
227
228 <div style='display:none;position:absolute;z-index:4;right:52px;height:44px;background-color:#282A35;letter-spacing:normal;' id='googleSearch'>
229 <div class='gcse-search'></div>
230 </div>
231 <div style='display:none;position:absolute;z-index:3;right:111px;height:44px;background-color:#282A35;text-align:right;padding-top:9px;' id='google_trans
232
233 <div class='w3-card-2 topnav notranslate' id='topnav'>
234 <div style="overflow:auto;">
235 <div class="w3-bar w3-left" style="width:100%;overflow:hidden;height:44px">
236 <a href='javascript:void(0);' class='topnav-icons fa fa-menu w3-hide-large w3-left w3-bar-item w3-button' onclick='open_menu()' title='Menu'></a>
237 <a href='/default.asp' class='topnav-icons fa fa-home w3-left w3-bar-item w3-button' title='Home'></a>
238 <a class="w3-bar-item w3-button" href='/html/default.asp' title='HTML Tutorial' style="padding-left:18px!important;padding-right:18px!important;">H
239 <a class="w3-bar-item w3-button" href='/css/default.asp' title='CSS Tutorial'>CSS</a>
240 <a class="w3-bar-item w3-button" href='/js/default.asp' title='JavaScript Tutorial'>JAVASCRIPT</a>
241 <a class="w3-bar-item w3-button" href='/sql/default.asp' title='SQL Tutorial'>SQL</a>
242 <a class="w3-bar-item w3-button" href='/python/default.asp' title='Python Tutorial'>PYTHON</a>
243 <a class="w3-bar-item w3-button" href='/java/default.asp' title='Java Tutorial'>JAVA</a>
244 <a class="w3-bar-item w3-button" href='/php/default.asp' title='PHP Tutorial'>PHP</a>
245 <a class="w3-bar-item w3-button" href='/bootstrap/bootstrap_ver.asp' title='Bootstrap Tutorial'>BOOTSTRAP</a>
246 <a class="w3-bar-item w3-button" href='/howto/default.asp' title='How To'>HOW TO</a>
247 <a class="w3-bar-item w3-button" href='/w3css/default.asp' title='W3.CSS Tutorial'>W3.CSS</a>
248 <a class="w3-bar-item w3-button" href='/c/index.php' title='C Tutorial'>C</a>
249 <a class="w3-bar-item w3-button" href='/cpp/default.asp' title='C++ Tutorial'>C++</a>
250 <a class="w3-bar-item w3-button" href='/cs/index.php' title='C# Tutorial'>C#</a>
251 <a class="w3-bar-item w3-button" href='/react/default.asp' title='React Tutorial'>REACT</a>
252 <a class="w3-bar-item w3-button" href='/r/default.asp' title='R Tutorial'>R</a>
253 <a class="w3-bar-item w3-button" href='/jquery/default.asp' title='jQuery Tutorial'>JQUERY</a>
254 <a class="w3-bar-item w3-button" href='/django/index.php' title='Django Tutorial'>DJANGO</a>
255 <a class="w3-bar-item w3-button" href='/typescript/index.php' title='Typescript Tutorial'>TYPESCRIPT</a>
256 <a class="w3-bar-item w3-button" href='/nodejs/default.asp' title='NodeJS Tutorial'>NODEJS</a>
257 <a class="w3-bar-item w3-button" href='/mysql/default.asp' title='MySQL Tutorial'>MYSQL</a>
258 <a href='javascript:void(0);' class='topnav-icons fa w3-right w3-bar-item w3-button' onclick='gSearch(this)' title='Search W3Schools'>&#xe802;</a>
259 <a href='javascript:void(0);' class='topnav-icons fa w3-right w3-bar-item w3-button' onclick='gTra(this)' title='Translate W3Schools'>&#xe801;</a>
260 <!-- <a href='javascript:void(0);' class='topnav-icons fa w3-right w3-bar-item w3-button' onclick='changecodetheme(this)' title='Toggle Dark Code Ex
261 <a href='javascript:void(0);' class='topnav-icons fa w3-right w3-bar-item w3-button' onmouseover="mouseoverdarkicon()" onmouseout="mouseoutofdarkic
262
263
264 <!--
265 <a class="w3-bar-item w3-button w3-right" id='topnavbtn_exercises' href='javascript:void(0);' onclick='w3_open_nav("exercises")' title='Exercises'>
266 -->
267
268 </div>
269
270 <div id="darkmodemenu" class="ws-black" onmouseover="mouseoverdarkicon()" onmouseout="mouseoutofdarkicon()">
271 <input id="radio_darkpage" type="checkbox" name="radio_theme_mode" onclick="click_darkpage()"><label for="radio_darkpage"> Dark mode</label>
272 <br>
273 <input id="radio_darkcode" type="checkbox" name="radio_theme_mode" onclick="click_darkcode()"><label for="radio_darkcode"> Dark code</label>
274 </div>
275
276 <nav id="nav_tutorials" class="w3-hide-small" style="position:absolute;padding-bottom:60px;">
277 <div class="w3-content" style="max-width:1100px;font-size:18px">
278 <span onclick="w3_close_nav('tutorials')" class="w3-button w3-xxxlarge w3-display-topright w3-hover-white sectionxsclosenavspan" style="padding-right:30
279 <div class="w3-row-padding w3-bar-block">
280 <div class="w3-container" style="padding-left:13px">
281 <h2 style="color:#FFF4A3;"><b>Tutorials</b></h2>
282 </div>
283 <div class="w3-col l3 m6">
284 <h3 class="w3-margin-top">HTML and CSS</h3>
285 <a class="w3-bar-item w3-button" href="/html/default.asp">Learn HTML</a>
286 <a class="w3-bar-item w3-button" href="/css/default.asp">Learn CSS</a>
287 <a class="w3-bar-item w3-button" href="/css/css_rwd_intro.asp" title="Responsive Web Design">Learn RWD</a>
288 <a class="w3-bar-item w3-button" href="/bootstrap/bootstrap_ver.asp">Learn Bootstrap</a>
289 <a class="w3-bar-item w3-button" href="/w3css/default.asp">Learn W3.CSS</a>
290 <a class="w3-bar-item w3-button" href="/colors/default.asp">Learn Colors</a>
291 <a class="w3-bar-item w3-button" href="/icons/default.asp">Learn Icons</a>
292 <a class="w3-bar-item w3-button" href="/graphics/default.asp">Learn Graphics</a>
293 <a class="w3-bar-item w3-button" href='/graphics/svg_intro.asp'>Learn SVG</a>
294 <a class="w3-bar-item w3-button" href='/graphics/canvas_intro.asp'>Learn Canvas</a>
295 <a class="w3-bar-item w3-button" href="/howto/default.asp">Learn How To</a>
296 <a class="w3-bar-item w3-button" href="/sass/default.php">Learn Sass</a>
297 <div class="w3-hide-large w3-hide-small">
298 <h3 class="w3-margin-top">Data Analytics</h3>
299 <a class="w3-bar-item w3-button" href="/ai/default.asp">Learn AI</a>
300 <a class="w3-bar-item w3-button" href="/python/python_ml_getting_started.asp">Learn Machine Learning</a>
301 <a class="w3-bar-item w3-button" href="/datascience/default.asp">Learn Data Science</a>
302 <a class="w3-bar-item w3-button" href="/python/numpy/default.asp">Learn NumPy</a>
303 <a class="w3-bar-item w3-button" href="/python/pandas/default.asp">Learn Pandas</a>
304 <a class="w3-bar-item w3-button" href="/python/scipy/index.php">Learn SciPy</a>
305 <a class="w3-bar-item w3-button" href="/python/matplotlib_intro.asp">Learn Matplotlib</a>
306 <a class="w3-bar-item w3-button" href="/statistics/index.php">Learn Statistics</a>
307 <a class="w3-bar-item w3-button" href="/excel/index.php">Learn Excel</a>
308
309 <h3 class="w3-margin-top">XML Tutorials</h3>
310 <a class="w3-bar-item w3-button" href="/xml/default.asp">Learn XML</a>
311 <a class="w3-bar-item w3-button" href='/xml/ajax_intro.asp'>Learn XML AJAX</a>
312 <a class="w3-bar-item w3-button" href="/xml/dom_intro.asp">Learn XML DOM</a>
313 <a class="w3-bar-item w3-button" href='/xml/xml_dtd_intro.asp'>Learn XML DTD</a>
314 <a class="w3-bar-item w3-button" href='/xml/schema_intro.asp'>Learn XML Schema</a>
315 <a class="w3-bar-item w3-button" href="/xml/xsl_intro.asp">Learn XSLT</a>
316 <a class="w3-bar-item w3-button" href='/xml/xpath_intro.asp'>Learn XPath</a>
317 <a class="w3-bar-item w3-button" href='/xml/xquery_intro.asp'>Learn XQuery</a>
318 </div>
319 </div>
320 <div class="w3-col l3 m6">
321 <h3 class="w3-margin-top">JavaScript</h3>
322 <a class="w3-bar-item w3-button" href="/js/default.asp">Learn JavaScript</a>
323 <a class="w3-bar-item w3-button" href="/jquery/default.asp">Learn jQuery</a>
324 <a class="w3-bar-item w3-button" href="/react/default.asp">Learn React</a>
325 <a class="w3-bar-item w3-button" href="/angular/default.asp">Learn AngularJS</a>
326 <a class="w3-bar-item w3-button" href="/js/js_json_intro.asp">Learn JSON</a>
327 <a class="w3-bar-item w3-button" href="/js/js_ajax_intro.asp">Learn AJAX</a>
328 <a class="w3-bar-item w3-button" href="/appml/default.asp">Learn AppML</a>
329 <a class="w3-bar-item w3-button" href="/w3js/default.asp">Learn W3.JS</a>
330
331 <h3 class="w3-margin-top">Programming</h3>
332 <a class="w3-bar-item w3-button" href="/python/default.asp">Learn Python</a>
333 <a class="w3-bar-item w3-button" href="/java/default.asp">Learn Java</a>
334 <a class="w3-bar-item w3-button" href="/c/index.php">Learn C</a>
335 <a class="w3-bar-item w3-button" href="/cpp/default.asp">Learn C++</a>
336 <a class="w3-bar-item w3-button" href="/cs/index.php">Learn C#</a>
337 <a class="w3-bar-item w3-button" href="/r/default.asp">Learn R</a>
338 <a class="w3-bar-item w3-button" href="/kotlin/index.php">Learn Kotlin</a>
339 <a class="w3-bar-item w3-button" href="/go/index.php">Learn Go</a>
340 <a class="w3-bar-item w3-button" href="/django/index.php">Learn Django</a>
341 <a class="w3-bar-item w3-button" href="/typescript/index.php">Learn TypeScript</a>
342 </div>
343 <div class="w3-col l3 m6">
344 <h3 class="w3-margin-top">Server Side</h3>
345 <a class="w3-bar-item w3-button" href="/sql/default.asp">Learn SQL</a>
346 <a class="w3-bar-item w3-button" href="/mysql/default.asp">Learn MySQL</a>
347 <a class="w3-bar-item w3-button" href="/php/default.asp">Learn PHP</a>
348 <a class="w3-bar-item w3-button" href='/asp/default.asp'>Learn ASP</a>
349 <a class="w3-bar-item w3-button" href='/nodejs/default.asp'>Learn Node.js</a>
350 <a class="w3-bar-item w3-button" href='/nodejs/nodejs_raspberrypi.asp'>Learn Raspberry Pi</a>
351 <a class="w3-bar-item w3-button" href='/git/default.asp'>Learn Git</a>
352 <a class="w3-bar-item w3-button" href='/mongodb/index.php'>Learn MongoDB</a>
353 <a class="w3-bar-item w3-button" href='/aws/index.php'>Learn AWS Cloud</a>
354
355 <h3 class="w3-margin-top">Web Building</h3>
356 <a class="w3-bar-item w3-button" href="/spaces/index.html" title="Get Your Own Website With W3shools Spaces">Create a Website <span class="ribbon-topn
357 <a class="w3-bar-item w3-button" href="/where_to_start.asp">Where To Start</a>
358 <a class="w3-bar-item w3-button" href="/w3css/w3css_templates.asp">Web Templates</a>
359 <a class="w3-bar-item w3-button" href="/browsers/default.asp">Web Statistics</a>
360 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com" target="_blank">Web Certificates</a>
361 <a class="w3-bar-item w3-button" href="/whatis/default.asp">Web Development</a>
362 <a class="w3-bar-item w3-button" href='/tryit/default.asp'>Code Editor</a>
363 <a class="w3-bar-item w3-button" href="/typingspeed/default.asp">Test Your Typing Speed</a>
364 <a class="w3-bar-item w3-button" href="/codegame/index.html" target="_blank">Play a Code Game</a>
365 <a class="w3-bar-item w3-button" href="/cybersecurity/index.php">Cyber Security</a>
366 <a class="w3-bar-item w3-button" href="/accessibility/index.php">Accessibility</a>
367 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/pages/newsletter" target="_blank">Join our Newsletter</a>
368 </div>
369 <div class="w3-col l3 m6 w3-hide-medium">
370 <h3 class="w3-margin-top">Data Analytics</h3>
371 <a class="w3-bar-item w3-button" href="/ai/default.asp">Learn AI</a>
372 <a class="w3-bar-item w3-button" href="/python/python_ml_getting_started.asp">Learn Machine Learning</a>
373 <a class="w3-bar-item w3-button" href="/datascience/default.asp">Learn Data Science</a>
374 <a class="w3-bar-item w3-button" href="/python/numpy/default.asp">Learn NumPy</a>
375 <a class="w3-bar-item w3-button" href="/python/pandas/default.asp">Learn Pandas</a>
376 <a class="w3-bar-item w3-button" href="/python/scipy/index.php">Learn SciPy</a>
377 <a class="w3-bar-item w3-button" href="/python/matplotlib_intro.asp">Learn Matplotlib</a>
378 <a class="w3-bar-item w3-button" href="/statistics/index.php">Learn Statistics</a>
379 <a class="w3-bar-item w3-button" href="/excel/index.php">Learn Excel</a>
380 <a class="w3-bar-item w3-button" href="/googlesheets/index.php">Learn Google Sheets</a>
381
382 <h3 class="w3-margin-top">XML Tutorials</h3>
383 <a class="w3-bar-item w3-button" href="/xml/default.asp">Learn XML</a>
384 <a class="w3-bar-item w3-button" href='/xml/ajax_intro.asp'>Learn XML AJAX</a>
385 <a class="w3-bar-item w3-button" href="/xml/dom_intro.asp">Learn XML DOM</a>
386 <a class="w3-bar-item w3-button" href='/xml/xml_dtd_intro.asp'>Learn XML DTD</a>
387 <a class="w3-bar-item w3-button" href='/xml/schema_intro.asp'>Learn XML Schema</a>
388 <a class="w3-bar-item w3-button" href="/xml/xsl_intro.asp">Learn XSLT</a>
389 <a class="w3-bar-item w3-button" href='/xml/xpath_intro.asp'>Learn XPath</a>
390 <a class="w3-bar-item w3-button" href='/xml/xquery_intro.asp'>Learn XQuery</a>
391 </div>
392 </div>
393 </div>
394 <br class="hidesm">
395 </nav>
396
397 <nav id="nav_references" class="w3-hide-small" style="position:absolute;padding-bottom:60px;">
398 <div class="w3-content" style="max-width:1100px;font-size:18px">
399 <span onclick="w3_close_nav('references')" class="w3-button w3-xxxlarge w3-display-topright w3-hover-white sectionxsclosenavspan" style="padding-right:3
400 <div class="w3-row-padding w3-bar-block">
401 <div class="w3-container" style="padding-left:13px">
402 <h2 style="color:#FFF4A3;"><b>References</b></h2>
403 </div>
404 <div class="w3-col l3 m6">
405 <h3 class="w3-margin-top">HTML</h3>
406 <a class="w3-bar-item w3-button" href='/tags/default.asp'>HTML Tag Reference</a>
407 <a class="w3-bar-item w3-button" href='/tags/ref_html_browsersupport.asp'>HTML Browser Support</a>
408 <a class="w3-bar-item w3-button" href='/tags/ref_eventattributes.asp'>HTML Event Reference</a>
409 <a class="w3-bar-item w3-button" href='/colors/default.asp'>HTML Color Reference</a>
410 <a class="w3-bar-item w3-button" href='/tags/ref_attributes.asp'>HTML Attribute Reference</a>
411 <a class="w3-bar-item w3-button" href='/tags/ref_canvas.asp'>HTML Canvas Reference</a>
412 <a class="w3-bar-item w3-button" href='/graphics/svg_reference.asp'>HTML SVG Reference</a>
413 <a class="w3-bar-item w3-button" href='/graphics/google_maps_reference.asp'>Google Maps Reference</a>
414 <h3 class="w3-margin-top">CSS</h3>
415 <a class="w3-bar-item w3-button" href='/cssref/index.php'>CSS Reference</a>
416 <a class="w3-bar-item w3-button" href='/cssref/css3_browsersupport.asp'>CSS Browser Support</a>
417 <a class="w3-bar-item w3-button" href='/cssref/css_selectors.asp'>CSS Selector Reference</a>
418 <a class="w3-bar-item w3-button" href='/bootstrap/bootstrap_ref_all_classes.asp'>Bootstrap 3 Reference</a>
419 <a class="w3-bar-item w3-button" href='/bootstrap4/bootstrap_ref_all_classes.asp'>Bootstrap 4 Reference</a>
420 <a class="w3-bar-item w3-button" href='/w3css/w3css_references.asp'>W3.CSS Reference</a>
421 <a class="w3-bar-item w3-button" href='/icons/icons_reference.asp'>Icon Reference</a>
422 <a class="w3-bar-item w3-button" href='/sass/sass_functions_string.php'>Sass Reference</a>
423 </div>
424 <div class="w3-col l3 m6">
425 <h3 class="w3-margin-top">JavaScript</h3>
426 <a class="w3-bar-item w3-button" href='/jsref/default.asp'>JavaScript Reference</a>
427 <a class="w3-bar-item w3-button" href='/jsref/default.asp'>HTML DOM Reference</a>
428 <a class="w3-bar-item w3-button" href='/jquery/jquery_ref_overview.asp'>jQuery Reference</a>
429 <a class="w3-bar-item w3-button" href='/angular/angular_ref_directives.asp'>AngularJS Reference</a>
430 <a class="w3-bar-item w3-button" href="/appml/appml_reference.asp">AppML Reference</a>
431 <a class="w3-bar-item w3-button" href="/w3js/w3js_references.asp">W3.JS Reference</a>
432
433 <h3 class="w3-margin-top">Programming</h3>
434 <a class="w3-bar-item w3-button" href='/python/python_reference.asp'>Python Reference</a>
435 <a class="w3-bar-item w3-button" href='/java/java_ref_keywords.asp'>Java Reference</a>
436 </div>
437 <div class="w3-col l3 m6">
438 <h3 class="w3-margin-top">Server Side</h3>
439 <a class="w3-bar-item w3-button" href='/sql/sql_ref_keywords.asp'>SQL Reference</a>
440 <a class="w3-bar-item w3-button" href='/mysql/mysql_ref_functions.asp'>MySQL Reference</a>
441 <a class="w3-bar-item w3-button" href='/php/php_ref_overview.asp'>PHP Reference</a>
442 <a class="w3-bar-item w3-button" href='/asp/asp_ref_response.asp'>ASP Reference</a>
443 <h3 class="w3-margin-top">XML</h3>
444 <a class="w3-bar-item w3-button" href='/xml/dom_nodetype.asp'>XML DOM Reference</a>
445 <a class="w3-bar-item w3-button" href='/xml/dom_http.asp'>XML Http Reference</a>
446 <a class="w3-bar-item w3-button" href='/xml/xsl_elementref.asp'>XSLT Reference</a>
447 <a class="w3-bar-item w3-button" href='/xml/schema_elements_ref.asp'>XML Schema Reference</a>
448 </div>
449 <div class="w3-col l3 m6">
450 <h3 class="w3-margin-top">Character Sets</h3>
451 <a class="w3-bar-item w3-button" href='/charsets/default.asp'>HTML Character Sets</a>
452 <a class="w3-bar-item w3-button" href='/charsets/ref_html_ascii.asp'>HTML ASCII</a>
453 <a class="w3-bar-item w3-button" href='/charsets/ref_html_ansi.asp'>HTML ANSI</a>
454 <a class="w3-bar-item w3-button" href='/charsets/ref_html_ansi.asp'>HTML Windows-1252</a>
455 <a class="w3-bar-item w3-button" href='/charsets/ref_html_8859.asp'>HTML ISO-8859-1</a>
456 <a class="w3-bar-item w3-button" href='/charsets/ref_html_symbols.asp'>HTML Symbols</a>
457 <a class="w3-bar-item w3-button" href='/charsets/ref_html_utf8.asp'>HTML UTF-8</a>
458 </div>
459 </div>
460 <br class="hidesm">
461 </div>
462 </nav>
463
464 <nav id="nav_exercises" class="w3-hide-small" style="position:absolute;padding-bottom:60px;">
465 <div class="w3-content" style="max-width:1100px;font-size:18px">
466 <span onclick="w3_close_nav('exercises')" class="w3-button w3-xxxlarge w3-display-topright w3-hover-white sectionxsclosenavspan" style="padding-right:30
467 <div class="w3-row-padding w3-bar-block">
468 <div class="w3-container" style="padding-left:13px">
469 <h2 style="color:#FFF4A3;"><b>Exercises and Quizzes</b></h2>
470 </div>
471 <div class="w3-col l3 m6">
472 <h3 class="w3-margin-top"><a class="ws-btn ws-yellow w3-hover-text-white" style="width:155px;font-size:21px" href="/exercises/index.php">Exercises</a>
473 <a class="w3-bar-item w3-button" href="/html/html_exercises.asp">HTML Exercises</a>
474 <a class="w3-bar-item w3-button" href="/css/css_exercises.asp">CSS Exercises</a>
475 <a class="w3-bar-item w3-button" href="/js/js_exercises.asp">JavaScript Exercises</a>
476 <a class="w3-bar-item w3-button" href="/python/python_exercises.asp">Python Exercises</a>
477 <a class="w3-bar-item w3-button" href="/sql/sql_exercises.asp">SQL Exercises</a>
478 <a class="w3-bar-item w3-button" href="/php/php_exercises.asp">PHP Exercises</a>
479 <a class="w3-bar-item w3-button" href="/java/java_exercises.asp">Java Exercises</a>
480 <a class="w3-bar-item w3-button" href="/c/c_exercises.php">C Exercises</a>
481 <a class="w3-bar-item w3-button" href="/cpp/cpp_exercises.asp">C++ Exercises</a>
482 <a class="w3-bar-item w3-button" href="/cs/cs_exercises.asp">C# Exercises</a>
483 <a class="w3-bar-item w3-button" href="/jquery/jquery_exercises.asp">jQuery Exercises</a>
484 <a class="w3-bar-item w3-button" href="/react/react_exercises.asp">React.js Exercises</a>
485 <a class="w3-bar-item w3-button" href="/mysql/mysql_exercises.asp">MySQL Exercises</a>
486 <a class="w3-bar-item w3-button" href="/bootstrap5/bootstrap_exercises.php">Bootstrap 5 Exercises</a>
487 <a class="w3-bar-item w3-button" href="/bootstrap4/bootstrap_exercises.asp">Bootstrap 4 Exercises</a>
488 <a class="w3-bar-item w3-button" href="/bootstrap/bootstrap_exercises.asp">Bootstrap 3 Exercises</a>
489 <a class="w3-bar-item w3-button" href="/python/numpy/numpy_exercises.asp">NumPy Exercises</a>
490 <a class="w3-bar-item w3-button" href="/python/pandas/pandas_exercises.asp">Pandas Exercises</a>
491 <a class="w3-bar-item w3-button" href="/python/scipy/scipy_exercises.php">SciPy Exercises</a>
492 <a class="w3-bar-item w3-button" href="/typescript/typescript_exercises.php">TypeScript Exercises</a>
493 <a class="w3-bar-item w3-button" href="/excel/excel_exercises.php">Excel Exercises</a>
494 <a class="w3-bar-item w3-button" href="/r/r_exercises.asp">R Exercises</a>
495 <a class="w3-bar-item w3-button" href="/git/git_exercises.asp">Git Exercises</a>
496 <a class="w3-bar-item w3-button" href="/kotlin/kotlin_exercises.php">Kotlin Exercises</a>
497 <a class="w3-bar-item w3-button" href="/go/go_exercises.php">Go Exercises</a>
498 <a class="w3-bar-item w3-button" href="/mongodb/mongodb_exercises.php">MongoDB Exercises</a>
499 </div>
500 <div class="w3-col l3 m6">
501 <h3 class="w3-margin-top"><a class="ws-btn ws-yellow w3-hover-text-white" style="width:135px;font-size:21px" href="/quiztest/default.asp">Quizzes</a><
502 <a class="w3-bar-item w3-button" href="/html/html_quiz.asp" target="_top">HTML Quiz</a>
503 <a class="w3-bar-item w3-button" href="/css/css_quiz.asp" target="_top">CSS Quiz</a>
504 <a class="w3-bar-item w3-button" href="/js/js_quiz.asp" target="_top">JavaScript Quiz</a>
505 <a class="w3-bar-item w3-button" href="/python/python_quiz.asp" target="_top">Python Quiz</a>
506 <a class="w3-bar-item w3-button" href="/sql/sql_quiz.asp" target="_top">SQL Quiz</a>
507 <a class="w3-bar-item w3-button" href="/php/php_quiz.asp" target="_top">PHP Quiz</a>
508 <a class="w3-bar-item w3-button" href="/java/java_quiz.asp" target="_top">Java Quiz</a>
509 <a class="w3-bar-item w3-button" href="/c/c_quiz.php">C Quiz</a>
510 <a class="w3-bar-item w3-button" href="/cpp/cpp_quiz.asp" target="_top">C++ Quiz</a>
511 <a class="w3-bar-item w3-button" href="/cs/cs_quiz.asp" target="_top">C# Quiz</a>
512 <a class="w3-bar-item w3-button" href="/jquery/jquery_quiz.asp" target="_top">jQuery Quiz</a>
513 <a class="w3-bar-item w3-button" href="/react/react_quiz.asp">React.js Quiz</a>
514 <a class="w3-bar-item w3-button" href="/mysql/mysql_quiz.asp" target="_top">MySQL Quiz</a>
515 <a class="w3-bar-item w3-button" href="/bootstrap5/bootstrap_quiz.php" target="_top">Bootstrap 5 Quiz</a>
516 <a class="w3-bar-item w3-button" href="/bootstrap4/bootstrap_quiz.asp" target="_top">Bootstrap 4 Quiz</a>
517 <a class="w3-bar-item w3-button" href="/bootstrap/bootstrap_quiz.asp" target="_top">Bootstrap 3 Quiz</a>
518 <a class="w3-bar-item w3-button" href="/python/numpy/numpy_quiz.asp" target="_top">NumPy Quiz</a>
519 <a class="w3-bar-item w3-button" href="/python/pandas/pandas_quiz.asp" target="_top">Pandas Quiz</a>
520 <a class="w3-bar-item w3-button" href="/python/scipy/scipy_quiz.php" target="_top">SciPy Quiz</a>
521 <a class="w3-bar-item w3-button" href="/typescript/typescript_quiz.php">TypeScript Quiz</a>
522 <a class="w3-bar-item w3-button" href="/xml/xml_quiz.asp" target="_top">XML Quiz</a>
523 <a class="w3-bar-item w3-button" href="/r/r_quiz.asp" target="_top">R Quiz</a>
524 <a class="w3-bar-item w3-button" href="/git/git_quiz.asp">Git Quiz</a>
525 <a class="w3-bar-item w3-button" href="/kotlin/kotlin_quiz.php" target="_top">Kotlin Quiz</a>
526 <a class="w3-bar-item w3-button" href="/cybersecurity/cybersecurity_quiz.php">Cyber Security Quiz</a>
527 <a class="w3-bar-item w3-button" href="/accessibility/accessibility_quiz.php">Accessibility Quiz</a>
528 </div>
529 <div class="w3-col l3 m6">
530 <h3 class="w3-margin-top"><a class="ws-btn ws-yellow w3-hover-text-white" style="width:135px;font-size:21px" href="https://campus.w3schools.com/collec
531 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/html-course" target="_blank">HTML Course</a>
532 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/css-course" target="_blank">CSS Course</a>
533 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/javascript-course" target="_blank">JavaScript
534 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/front-end-course" target="_blank">Front End Co
535 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/python-course" target="_blank">Python Course</
536 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/sql-course" target="_blank">SQL Course</a>
537 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/php-course" target="_blank">PHP Course</a>
538 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/java-course" target="_blank">Java Course</a>
539 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/c-course-1" target="_blank">C++ Course</a>
540 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/c-course" target="_blank">C# Course</a>
541 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/jquery-course" target="_blank">jQuery Course</
542 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/react-js-course" target="_blank">React.js Cour
543 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/bootstrap-4-course" target="_blank">Bootstrap
544 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/bootstrap-course" target="_blank">Bootstrap 3
545 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/numpy-course" target="_blank">NumPy Course</a>
546 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/pandas-course" target="_blank">Pandas Course</
547 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/learn-typescript" target="_blank">TypeScript C
548 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/xml-course" target="_blank">XML Course</a>
549 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/r-course" target="_blank">R Course</a>
550 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/data-analytics-program" target="_blank">Data A
551 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/cyber-security-course" target="_blank">Cyber S
552 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/course-catalog/products/accessibility-course" target="_blank">Accessib
553 </div>
554 <div class="w3-col l3 m6">
555 <h3 class="w3-margin-top"><a class="ws-btn ws-yellow w3-hover-text-white" style="width:150px;font-size:21px" href="https://campus.w3schools.com/collec
556 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/html-certificate" target="_blank">HTML Certifi
557 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/css-certificate" target="_blank">CSS Certifica
558 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/javascript-certificate" target="_blank">JavaSc
559 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/front-end-certificate" target="_blank">Front E
560 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/python-certificate" target="_blank">Python Cer
561 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/sql-certificate" target="_blank">SQL Certifica
562 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/php-certificate" target="_blank">PHP Certifica
563 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/java-certificate" target="_blank">Java Certifi
564 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/c-certificate" target="_blank">C++ Certificate
565 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/c-certificate-1" target="_blank">C# Certificat
566 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/jquery-certificate" target="_blank">jQuery Cer
567 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/react-js-certificate" target="_blank">React.js
568 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/mysql-certificate" target="_blank">MySQL Certi
569 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/bootstrap-5-certificate" target="_blank">Boots
570 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/bootstrap-4-certificate" target="_blank">Boots
571 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/bootstrap-3-certificate" target="_blank">Boots
572 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/typescript-certificate" target="_blank">TypeSc
573 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/xml-certificate" target="_blank">XML Certifica
574 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/excel-certificate" target="_blank">Excel Certi
575 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/data-science-certificate" target="_blank">Data
576 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/cyber-security-certificate" target="_blank">Cy
577 <a class="w3-bar-item w3-button" href="https://campus.w3schools.com/collections/certifications/products/accessibility-certificate" target="_blank">Acc
578 </div>
579 </div>
580 <br class="hidesm">
581 </div>
582 </nav>
583
584 </div>
585 </div>
586
587 <div id='myAccordion' class="w3-card-2 w3-center w3-hide-large w3-hide-medium ws-grey" style="width:100%;position:absolute;display:none;">
588 <a href="javascript:void(0)" onclick="w3_close()" class="w3-button w3-xxlarge w3-right">&times;</a><br>
589 <div class="w3-container w3-padding-32">
590 <a class="w3-button w3-block" style="font-size:22px;" onclick="open_xs_menu('tutorials');" href="javascript:void(0);">Tutorials <i class='fa fa-caret
591 <div id="sectionxs_tutorials" class="w3-left-align w3-show" style="background-color:#282A35;color:white;"></div>
592 <a class="w3-button w3-block" style="font-size:22px;" onclick="open_xs_menu('references')" href="javascript:void(0);">References <i class='fa fa-care
593 <div id="sectionxs_references" class="w3-left-align w3-show" style="background-color:#282A35;color:white;"></div>
594 <a class="w3-button w3-block" style="font-size:22px;" onclick="open_xs_menu('exercises')" href="javascript:void(0);">Exercises <i class='fa fa-caret-
595 <div id="sectionxs_exercises" class="w3-left-align w3-show" style="background-color:#282A35;color:white;"></div>
596 <a class="w3-button w3-block" style="font-size:22px;" href="https://campus.w3schools.com/collections/course-catalog" target="_blank">Get Certified</a
597 <a class="w3-button w3-block" style="font-size:22px;" href="/signup/index.html">Sign Up</a>
598 <a class="w3-button w3-block" style="font-size:22px;" href="/pro/index.php" title="Upgrade to Improve Your Learning Experiences">Upgrade</a>
599 <a class="w3-button w3-block" style="font-size:22px;" href="/spaces/index.html" title="Get Your Own Website With W3schools Spaces">Spaces</a>
600 <a class="w3-button w3-block" style="font-size:22px;" href="/bootcamp/index.php">Bootcamp</a>
601 <a class="w3-button w3-block" style="font-size:22px;" href="/videos/index.php" title="Video Tutorials">Videos</a>
602 <a class="w3-button w3-block" style="font-size:22px;" href="https://campus.w3schools.com" target="_blank">Shop</a>
603 </div>
604 </div>
605
606 <script>
607 (
608 function setThemeCheckboxes() {
609 var x = localStorage.getItem("preferredmode");
610 var y = localStorage.getItem("preferredpagemode");
611 if (x == "dark") {
612 document.getElementById("radio_darkcode").checked = true;
613
614 }
615 if (y == "dark") {
616 document.getElementById("radio_darkpage").checked = true;
617 }
618 })();
619
620 function mouseoverdarkicon() {
621 if(window.matchMedia("(pointer: coarse)").matches) {
622 return false;
623 }
624 var a = document.getElementById("darkmodemenu");
625 a.style.top = "44px";
626 }
627 function mouseoutofdarkicon() {
628 var a = document.getElementById("darkmodemenu");
629 a.style.top = "-40px";
630 }
631 function changepagetheme(n) {
632 var a = document.getElementById("radio_darkcode");
633 var b = document.getElementById("radio_darkpage");
634 document.body.className = document.body.className.replace("darktheme", "");
635 document.body.className = document.body.className.replace("darkpagetheme", "");
636 document.body.className = document.body.className.replace(" ", " ");
637 if (a.checked && b.checked) {
638 localStorage.setItem("preferredmode", "light");
639 localStorage.setItem("preferredpagemode", "light");
640 a.checked = false;
641 b.checked = false;
642 } else {
643 document.body.className += " darktheme";
644 document.body.className += " darkpagetheme";
645 localStorage.setItem("preferredmode", "dark");
646 localStorage.setItem("preferredpagemode", "dark");
647 a.checked = true;
648 b.checked = true;
649 }
650 }
651
652
653 function click_darkpage() {
654 var b = document.getElementById("radio_darkpage");
655 if (b.checked) {
656 document.body.className += " darkpagetheme";
657 document.body.className = document.body.className.replace(" ", " ");
658 localStorage.setItem("preferredpagemode", "dark");
659 } else {
660 document.body.className = document.body.className.replace("darkpagetheme", "");
661 document.body.className = document.body.className.replace(" ", " ");
662 localStorage.setItem("preferredpagemode", "light");
663 }
664 }
665
666 function click_darkcode() {
667 var a = document.getElementById("radio_darkcode");
668 if (a.checked) {
669 document.body.className += " darktheme";
670 document.body.className = document.body.className.replace(" ", " ");
671 localStorage.setItem("preferredmode", "dark");
672 } else {
673 document.body.className = document.body.className.replace("darktheme", "");
674 document.body.className = document.body.className.replace(" ", " ");
675 localStorage.setItem("preferredmode", "light");
676 }
677 }
678 </script>
679
680 <div class='w3-sidebar w3-collapse' id='sidenav'>
681 <div id='leftmenuinner'>
682 <div id='leftmenuinnerinner'>
683 <!-- <a href='javascript:void(0)' onclick='close_menu()' class='w3-button w3-hide-large w3-large w3-display-topright' style='right:16px;padding:3px 12px
684 <h2 class="left">JS Tutorial</h2>
685 <a target="_top" href="default.asp">JS HOME</a>
686 <a target="_top" href="js_intro.asp">JS Introduction</a>
687 <a target="_top" href="js_whereto.asp">JS Where To</a>
688 <a target="_top" href="js_output.asp">JS Output</a>
689 <a target="_top" href="js_statements.asp">JS Statements</a>
690 <a target="_top" href="js_syntax.asp">JS Syntax</a>
691 <a target="_top" href="js_comments.asp">JS Comments</a>
692 <a target="_top" href="js_variables.asp">JS Variables</a>
693 <a target="_top" href="js_let.asp">JS Let</a>
694 <a target="_top" href="js_const.asp">JS Const</a>
695 <a target="_top" href="js_operators.asp">JS Operators</a>
696 <a target="_top" href="js_arithmetic.asp">JS Arithmetic</a>
697 <a target="_top" href="js_assignment.asp">JS Assignment</a>
698 <a target="_top" href="js_datatypes.asp">JS Data Types</a>
699 <a target="_top" href="js_functions.asp">JS Functions</a>
700 <a target="_top" href="js_objects.asp">JS Objects</a>
701 <a target="_top" href="js_events.asp">JS Events</a>
702 <a target="_top" href="js_strings.asp">JS Strings</a>
703 <a target="_top" href="js_string_methods.asp">JS String Methods</a>
704 <a target="_top" href="js_string_search.asp">JS String Search</a>
705 <a target="_top" href="js_string_templates.asp">JS String Templates</a>
706 <a target="_top" href="js_numbers.asp">JS Numbers</a>
707 <a target="_top" href="js_bigint.asp">JS BigInt</a>
708 <a target="_top" href="js_number_methods.asp">JS Number Methods</a>
709 <a target="_top" href="js_number_properties.asp">JS Number Properties</a>
710 <a target="_top" href="js_arrays.asp">JS Arrays</a>
711 <a target="_top" href="js_array_methods.asp">JS Array Methods</a>
712 <a target="_top" href="js_array_sort.asp">JS Array Sort</a>
713 <a target="_top" href="js_array_iteration.asp">JS Array Iteration</a>
714 <a target="_top" href="js_array_const.asp">JS Array Const</a>
715 <a target="_top" href="js_dates.asp">JS Dates</a>
716 <a target="_top" href="js_date_formats.asp">JS Date Formats</a>
717 <a target="_top" href="js_date_methods.asp">JS Date Get Methods</a>
718 <a target="_top" href="js_date_methods_set.asp">JS Date Set Methods</a>
719 <a target="_top" href="js_math.asp">JS Math</a>
720 <a target="_top" href="js_random.asp">JS Random</a>
721 <a target="_top" href="js_booleans.asp">JS Booleans</a>
722 <a target="_top" href="js_comparisons.asp">JS Comparisons</a>
723 <a target="_top" href="js_if_else.asp">JS If Else</a>
724 <a target="_top" href="js_switch.asp">JS Switch</a>
725 <a target="_top" href="js_loop_for.asp">JS Loop For</a>
726 <a target="_top" href="js_loop_forin.asp">JS Loop For In</a>
727 <a target="_top" href="js_loop_forof.asp">JS Loop For Of</a>
728 <a target="_top" href="js_loop_while.asp">JS Loop While</a>
729 <a target="_top" href="js_break.asp">JS Break</a>
730 <a target="_top" href="js_iterables.asp">JS Iterables</a>
731 <a target="_top" href="js_sets.asp">JS Sets</a>
732 <a target="_top" href="js_maps.asp">JS Maps</a>
733 <a target="_top" href="js_typeof.asp">JS Typeof</a>
734 <a target="_top" href="js_type_conversion.asp">JS Type Conversion</a>
735 <a target="_top" href="js_bitwise.asp">JS Bitwise</a>
736 <a target="_top" href="js_regexp.asp">JS RegExp</a>
737 <a target="_top" href="js_precedence.asp">JS Precedence</a>
738 <a target="_top" href="js_errors.asp">JS Errors</a>
739 <a target="_top" href="js_scope.asp">JS Scope</a>
740 <a target="_top" href="js_hoisting.asp">JS Hoisting</a>
741 <a target="_top" href="js_strict.asp">JS Strict Mode</a>
742 <a target="_top" href="js_this.asp">JS this Keyword</a>
743 <a target="_top" href="js_arrow_function.asp">JS Arrow Function</a>
744 <a target="_top" href="js_classes.asp">JS Classes</a>
745 <a target="_top" href="js_modules.asp">JS Modules</a>
746 <a target="_top" href="js_json.asp">JS JSON</a>
747 <a target="_top" href="js_debugging.asp">JS Debugging</a>
748 <a target="_top" href="js_conventions.asp">JS Style Guide</a>
749 <a target="_top" href="js_best_practices.asp">JS Best Practices</a>
750 <a target="_top" href="js_mistakes.asp">JS Mistakes</a>
751 <a target="_top" href="js_performance.asp">JS Performance</a>
752 <a target="_top" href="js_reserved.asp">JS Reserved Words</a>
753 <br>
754 <h2 class="left">JS Versions</h2>
755 <a target="_top" href="js_versions.asp">JS Versions</a>
756 <a target="_top" href="js_es5.asp">JS 2009 (ES5)</a>
757 <a target="_top" href="js_es6.asp">JS 2015 (ES6)</a>
758 <a target="_top" href="js_2016.asp">JS 2016</a>
759 <a target="_top" href="js_2017.asp">JS 2017</a>
760 <a target="_top" href="js_2018.asp">JS 2018</a>
761 <a target="_top" href="js_2019.asp">JS 2019</a>
762 <a target="_top" href="js_2020.asp">JS 2020</a>
763 <a target="_top" href="js_2021.asp">JS 2021/2022</a>
764 <a target="_top" href="js_ie_edge.asp">JS IE / Edge</a>
765 <a target="_top" href="js_history.asp">JS History</a>
766 <br>
767 <h2 class="left">JS Objects</h2>
768 <a target="_top" href="js_object_definition.asp">Object Definitions</a>
769 <a target="_top" href="js_object_properties.asp">Object Properties</a>
770 <a target="_top" href="js_object_methods.asp">Object Methods</a>
771 <a target="_top" href="js_object_display.asp">Object Display</a>
772 <a target="_top" href="js_object_accessors.asp">Object Accessors</a>
773 <a target="_top" href="js_object_constructors.asp">Object Constructors</a>
774 <a target="_top" href="js_object_prototypes.asp">Object Prototypes</a>
775 <a target="_top" href="js_object_iterables.asp">Object Iterables</a>
776 <a target="_top" href="js_object_sets.asp">Object Sets</a>
777 <a target="_top" href="js_object_maps.asp">Object Maps</a>
778 <a target="_top" href="js_object_es5.asp">Object Reference</a>
779 <br>
780 <h2 class="left">JS Functions</h2>
781 <a target="_top" href="js_function_definition.asp">Function Definitions</a>
782 <a target="_top" href="js_function_parameters.asp">Function Parameters</a>
783 <a target="_top" href="js_function_invocation.asp">Function Invocation</a>
784 <a target="_top" href="js_function_call.asp">Function Call</a>
785 <a target="_top" href="js_function_apply.asp">Function Apply</a>
786 <a target="_top" href="js_function_bind.asp">Function Bind</a>
787 <a target="_top" href="js_function_closures.asp">Function Closures</a>
788 <br>
789 <h2 class="left">JS Classes</h2>
790 <a target="_top" href="js_class_intro.asp">Class Intro</a>
791 <a target="_top" href="js_class_inheritance.asp">Class Inheritance</a>
792 <a target="_top" href="js_class_static.asp">Class Static</a>
793 <br>
794 <h2 class="left">JS Async</h2>
795 <a target="_top" href="js_callback.asp">JS Callbacks</a>
796 <a target="_top" href="js_asynchronous.asp">JS Asynchronous</a>
797 <a target="_top" href="js_promise.asp">JS Promises</a>
798 <a target="_top" href="js_async.asp">JS Async/Await</a>
799 <br>
800 <h2 class="left">JS HTML DOM</h2>
801 <a target="_top" href="js_htmldom.asp">DOM Intro</a>
802 <a target="_top" href="js_htmldom_methods.asp">DOM Methods</a>
803 <a target="_top" href="js_htmldom_document.asp">DOM Document</a>
804 <a target="_top" href="js_htmldom_elements.asp">DOM Elements</a>
805 <a target="_top" href="js_htmldom_html.asp">DOM HTML</a>
806 <a target="_top" href="js_validation.asp">DOM Forms</a>
807 <a target="_top" href="js_htmldom_css.asp">DOM CSS</a>
808 <a target="_top" href="js_htmldom_animate.asp">DOM Animations</a>
809 <a target="_top" href="js_htmldom_events.asp">DOM Events</a>
810 <a target="_top" href="js_htmldom_eventlistener.asp">DOM Event Listener</a>
811 <a target="_top" href="js_htmldom_navigation.asp">DOM Navigation</a>
812 <a target="_top" href="js_htmldom_nodes.asp">DOM Nodes</a>
813 <a target="_top" href="js_htmldom_collections.asp">DOM Collections</a>
814 <a target="_top" href="js_htmldom_nodelist.asp">DOM Node Lists</a>
815 <br>
816 <h2 class="left">JS Browser BOM</h2>
817 <a target="_top" href="js_window.asp">JS Window</a>
818 <a target="_top" href="js_window_screen.asp">JS Screen</a>
819 <a target="_top" href="js_window_location.asp">JS Location</a>
820 <a target="_top" href="js_window_history.asp">JS History</a>
821 <a target="_top" href="js_window_navigator.asp">JS Navigator</a>
822 <a target="_top" href="js_popup.asp">JS Popup Alert</a>
823 <a target="_top" href="js_timing.asp">JS Timing</a>
824 <a target="_top" href="js_cookies.asp">JS Cookies</a>
825 <br>
826 <h2 class="left">JS Web APIs</h2>
827 <a target="_top" href="js_api_intro.asp">Web API Intro</a>
828 <a target="_top" href="js_validation_api.asp">Web Forms API</a>
829 <a target="_top" href="js_api_history.asp">Web History API</a>
830 <a target="_top" href="js_api_web_storage.asp">Web Storage API</a>
831 <a target="_top" href="js_api_web_workers.asp">Web Worker API</a>
832 <a target="_top" href="js_api_fetch.asp">Web Fetch API</a>
833 <a target="_top" href="js_api_geolocation.asp">Web Geolocation API</a>
834 <br>
835 <h2 class="left">JS AJAX</h2>
836 <a target="_top" href="js_ajax_intro.asp">AJAX Intro</a>
837 <a target="_top" href="js_ajax_http.asp">AJAX XMLHttp</a>
838 <a target="_top" href="js_ajax_http_send.asp">AJAX Request</a>
839 <a target="_top" href="js_ajax_http_response.asp">AJAX Response</a>
840 <a target="_top" href="js_ajax_xmlfile.asp">AJAX XML File</a>
841 <a target="_top" href="js_ajax_php.asp">AJAX PHP</a>
842 <a target="_top" href="js_ajax_asp.asp">AJAX ASP</a>
843 <a target="_top" href="js_ajax_database.asp">AJAX Database</a>
844 <a target="_top" href="js_ajax_applications.asp">AJAX Applications</a>
845 <a target="_top" href="js_ajax_examples.asp">AJAX Examples</a>
846 <br>
847 <h2 class="left">JS JSON</h2>
848 <a target="_top" href="js_json_intro.asp">JSON Intro</a>
849 <a target="_top" href="js_json_syntax.asp">JSON Syntax</a>
850 <a target="_top" href="js_json_xml.asp">JSON vs XML</a>
851 <a target="_top" href="js_json_datatypes.asp">JSON Data Types</a>
852 <a target="_top" href="js_json_parse.asp">JSON Parse</a>
853 <a target="_top" href="js_json_stringify.asp">JSON Stringify</a>
854 <a target="_top" href="js_json_objects.asp">JSON Objects</a>
855 <a target="_top" href="js_json_arrays.asp">JSON Arrays</a>
856 <a target="_top" href="js_json_server.asp">JSON Server</a>
857 <a target="_top" href="js_json_php.asp">JSON PHP</a>
858 <a target="_top" href="js_json_html.asp">JSON HTML</a>
859 <a target="_top" href="js_json_jsonp.asp">JSON JSONP</a>
860 <br>
861 <h2 class="left">JS vs jQuery</h2>
862 <a target="_top" href="js_jquery_selectors.asp">jQuery Selectors</a>
863 <a target="_top" href="js_jquery_elements.asp">jQuery HTML</a>
864 <a target="_top" href="js_jquery_css.asp">jQuery CSS</a>
865 <a target="_top" href="js_jquery_dom.asp">jQuery DOM</a>
866 <br>
867 <h2 class="left">JS Graphics</h2>
868 <a target="_top" href="js_graphics.asp">JS Graphics</a>
869 <a target="_top" href="js_graphics_canvas.asp">JS Canvas</a>
870 <a target="_top" href="js_graphics_plotly.asp">JS Plotly</a>
871 <a target="_top" href="js_graphics_chartjs.asp">JS Chart.js</a>
872 <a target="_top" href="js_graphics_google_chart.asp">JS Google Chart</a>
873 <a target="_top" href="js_graphics_d3js.asp">JS D3.js</a>
874 <br>
875 <h2 class="left">JS Examples</h2>
876 <a target="_top" href="js_examples.asp">JS Examples</a>
877 <a target="_top" href="js_dom_examples.asp">JS HTML DOM</a>
878 <a target="_top" href="js_input_examples.asp">JS HTML Input</a>
879 <a target="_top" href="js_ex_dom.asp">JS HTML Objects</a>
880 <a target="_top" href="js_events_examples.asp">JS HTML Events</a>
881 <a target="_top" href="js_ex_browser.asp">JS Browser</a>
882 <a target="_top" href="js_editor.asp">JS Editor</a>
883 <a target="_top" href="js_exercises.asp">JS Exercises</a>
884 <a target="_top" href="js_quiz.asp">JS Quiz</a>
885 <a target="_top" href="js_exam.asp">JS Certificate</a>
886 <br>
887 <h2 class="left">JS References</h2>
888 <a target="_top" href="/jsref/default.asp">JavaScript Objects</a>
889 <a target="_top" href="/jsref/default.asp">HTML DOM Objects</a>
890 <br>
891 <br><br>
892 </div>
893 </div>
894 </div>
895 <div class='w3-main w3-light-grey' id='belowtopnav' style='margin-left:220px;'>
896 <div class='w3-row w3-white'>
897 <div class='w3-col l10 m12' id='main'>
898 <div id='mainLeaderboard' style='overflow:hidden;'>
899 <!-- MainLeaderboard-->
900
901 <!--<pre>main_leaderboard, all: [728,90][970,90][320,50][468,60]</pre>-->
902 <div id="adngin-main_leaderboard-0"></div>
903 <!-- adspace leaderboard -->
904
905 </div>
906 <h1>JavaScript <span class="color_h1">Syntax</span></h1>
907 <div class="w3-clear nextprev">
908 <a class="w3-left w3-btn" href="js_statements.asp">&#10094; Previous</a>
909 <a class="w3-right w3-btn" href="js_comments.asp">Next &#10095;</a>
910 </div>
911 <div class="w3-info">
912 <p class="intro">JavaScript syntax is the set of&nbsp;rules, how
913 JavaScript programs are constructed:</p>
914 <div class="w3-code w3-large w3-border notranslate jsHigh">
915 // How to create variables:<br>
916 var x;<br>
917 let y;<br>
918 <br>
919 // How to use variables:<br>
920 x = 5;<br>
921 y = 6;<br>
922 let z = x + y;<br>
923 </div>
924 </div>
925
926 <h2>JavaScript Values</h2>
927 <p>The JavaScript syntax defines two types of values:</p>
928 <ul>
929 <li>Fixed values</li>
930 <li>Variable values</li>
931 </ul>
932 <p>Fixed values are called <b>Literals</b>.</p>
933 <p>Variable values are called <b>Variables</b>.</p>
934
935 <hr>
936 <h2>JavaScript Literals</h2>
937 <p>The two most important syntax rules for fixed values are:</p>
938 <p>1. <strong>Numbers</strong> are written with or
939 without decimals:</p>
940 <div class="w3-example">
941 <div class="w3-code notranslate jsHigh">
942 10.50<br><br>
943 1001 </div>
944 <a target="_blank" class="w3-btn w3-margin-bottom" href="tryit.asp?filename=tryjs_syntax_numbers">Try it Yourself &raquo;</a>
945 </div>
946 <p>2. <strong>Strings</strong> are text, written within double or single quotes:</p>
947
948 <div class="w3-example">
949 <div class="w3-code notranslate jsHigh">
950 &quot;John Doe&quot;<br><br>
951 'John Doe'
952 </div>
953 <a target="_blank" class="w3-btn w3-margin-bottom" href="tryit.asp?filename=tryjs_syntax_strings">Try it Yourself &raquo;</a>
954 </div>
955 <hr>
956 <div id="midcontentadcontainer" style="overflow:auto;text-align:center">
957 <!-- MidContent -->
958 <!-- <p class="adtext">Advertisement</p> -->
959
960 <div id="adngin-mid_content-0"></div>
961
962 </div>
963 <hr>
964
965 <h2>JavaScript Variables</h2>
966 <p>In a programming language, <strong>variables</strong>
967 are used to <strong>store</strong> data values.</p>
968 <p>JavaScript uses the keywords <code class="w3-codespan">var</code>,
969 <code class="w3-codespan">let</code> and <code class="w3-codespan">const</code> to <strong>declare</strong> variables.</p>
970 <p>An <strong>equal sign</strong> is used to <strong>assign values</strong> to variables.</p>
971 <p>In this example, x is defined as a variable. Then, x is
972 assigned (given) the value
973 6:</p>
974 <div class="w3-example">
975 <div class="w3-code notranslate jsHigh">
976 let x;<br>
977 x = 6; </div>
978 <a target="_blank" class="w3-btn w3-margin-bottom" href="tryit.asp?filename=tryjs_syntax_variables">Try it Yourself &raquo;</a>
979 </div>
980 <hr>
981
982 <h2>JavaScript Operators</h2>
983
984 <p>JavaScript uses <strong>arithmetic operators</strong> ( <code class="w3-codespan">+</code> <code class="w3-codespan">-</code> <code class="w3-codespan
985 <strong>compute</strong> values: </p>
986 <div class="w3-example">
987 <div class="w3-code notranslate jsHigh">
988 (5 + 6) * 10<br>
989 </div>
990 <a target="_blank" class="w3-btn w3-margin-bottom" href="tryit.asp?filename=tryjs_syntax_operators">Try it Yourself &raquo;</a>
991 </div>
992 <p>JavaScript uses an <strong>assignment operator</strong> ( <code class="w3-codespan">=</code> ) to <strong>assign</strong>
993 values to variables: </p>
994 <div class="w3-example">
995 <div class="w3-code notranslate jsHigh">
996 let x, y;<br>x = 5;<br>
997 y = 6;</div>
998 <a target="_blank" class="w3-btn w3-margin-bottom" href="tryit.asp?filename=tryjs_syntax_assign">Try it Yourself &raquo;</a>
999 </div>
1000 <hr>
1001
1002 <h2>JavaScript Expressions</h2>
1003 <p>An expression is a combination of values, variables, and operators,
1004 which computes to a value.</p>
1005 <p>The computation is called an evaluation.</p>
1006 <p>For example, 5 * 10 evaluates to 50:</p>
1007 <div class="w3-example">
1008 <div class="w3-code notranslate jsHigh">
1009 5 * 10
1010 </div>
1011 <a target="_blank" class="w3-btn w3-margin-bottom" href="tryit.asp?filename=tryjs_syntax_expressions">Try it Yourself &raquo;</a>
1012 </div>
1013 <p>Expressions can also contain variable values:</p>
1014 <div class="w3-example">
1015 <div class="w3-code notranslate jsHigh">
1016 x * 10
1017 </div>
1018 <a class="w3-btn w3-margin-bottom" href="tryit.asp?filename=tryjs_syntax_expressions_variables" target="_blank">Try it Yourself &raquo;</a>
1019 </div>
1020 <p>The values can be of various types, such as numbers and strings.</p>
1021 <p>For example, &quot;John&quot; + &quot; &quot; + &quot;Doe&quot;, evaluates to &quot;John Doe&quot;:</p>
1022 <div class="w3-example">
1023 <div class="w3-code notranslate jsHigh">
1024 &quot;John&quot; + &quot; &quot; + &quot;Doe&quot;
1025 </div>
1026 <a class="w3-btn w3-margin-bottom" href="tryit.asp?filename=tryjs_syntax_expressions_strings" target="_blank">Try it Yourself &raquo;</a>
1027 </div>
1028 <hr>
1029
1030 <h2>JavaScript Keywords</h2>
1031 <p>JavaScript <strong>keywords</strong> are used to
1032 identify actions to be performed.</p>
1033 <p>The
1034 <code class="w3-codespan">let</code> keyword tells the browser to create variables:</p>
1035 <div class="w3-example">
1036 <div class="w3-code notranslate jsHigh">
1037 let x, y;<br>x = 5 + 6;<br>y = x * 10;
1038 </div>
1039 <a target="_blank" class="w3-btn w3-margin-bottom" href="tryit.asp?filename=tryjs_syntax_let">Try it Yourself &raquo;</a>
1040 </div>
1041
1042 <p>The
1043 <code class="w3-codespan">var</code> keyword also tells the browser to create variables:</p>
1044 <div class="w3-example">
1045 <div class="w3-code notranslate jsHigh">
1046 var x, y;<br>x = 5 + 6;<br>y = x * 10;
1047 </div>
1048 <a target="_blank" class="w3-btn w3-margin-bottom" href="tryit.asp?filename=tryjs_syntax_keywords">Try it Yourself &raquo;</a>
1049 </div>
1050 <div class="w3-note">
1051 <p>In these examples, using <code class="w3-codespan">var</code>
1052 or <code class="w3-codespan">let</code> will produce the same result.</p>
1053 <p>You will learn more about <code class="w3-codespan">var</code>
1054 and <code class="w3-codespan">let</code> later in this tutorial.</p>
1055
1056 </div>
1057
1058 <hr>
1059
1060 <h2>JavaScript Comments</h2>
1061 <p>Not all JavaScript statements are &quot;executed&quot;.</p>
1062 <p>Code after double slashes
1063 <code class="w3-codespan">//</code> or between <code class="w3-codespan">/*</code> and <code class="w3-codespan">*/</code> is treated as a <strong>commen
1064 <p>Comments are ignored, and will not be
1065 executed:</p>
1066 <div class="w3-example">
1067 <div class="w3-code notranslate jsHigh">
1068 let x = 5;&nbsp;&nbsp; // I will be executed<br><br>// x = 6;&nbsp;&nbsp; I will
1069 NOT be executed</div>
1070 <a target="_blank" class="w3-btn w3-margin-bottom" href="tryit.asp?filename=tryjs_syntax_comments">Try it Yourself &raquo;</a>
1071 </div>
1072 <div class="w3-panel w3-note">
1073 <p>You will learn more about comments in a later chapter.</p>
1074 </div>
1075 <hr>
1076
1077 <h2>JavaScript Identifiers / Names</h2>
1078 <p>Identifiers are JavaScript names.</p>
1079 <p>Identifiers are used to name variables and keywords, and functions.</p>
1080 <p>The rules for legal names are the same in most programming languages.</p>
1081 <p>A JavaScript name must begin with:</p>
1082 <ul>
1083 <li>A letter (A-Z or a-z)</li>
1084 <li>A dollar sign ($)</li>
1085 <li>Or an underscore (_)</li>
1086 </ul>
1087 <p>Subsequent characters may be letters, digits, underscores, or dollar signs.</p>
1088
1089 <div class="w3-panel w3-note">
1090 <h2>Note</h2>
1091 <p>Numbers are not allowed as the first character in names.</p>
1092 <p>This way JavaScript can easily distinguish identifiers from numbers.</p>
1093 </div>
1094
1095 <hr>
1096 <h2>JavaScript is Case Sensitive</h2>
1097 <p>All JavaScript identifiers are
1098 <strong>case sensitive</strong>.&nbsp; </p>
1099 <p>The variables <code class="w3-codespan">lastName</code> and <code class="w3-codespan">lastname</code>,
1100 are two different variables:</p>
1101 <div class="w3-example">
1102 <div class="w3-code notranslate jsHigh">
1103 let lastname, lastName;<br>lastName = &quot;Doe&quot;;<br>lastname = &quot;Peterson&quot;;
1104 </div>
1105 <a target="_blank" class="w3-btn w3-margin-bottom" href="tryit.asp?filename=tryjs_syntax_case">Try it Yourself &raquo;</a>
1106 </div>
1107 <p>JavaScript does not interpret <b>LET</b> or <b>Let</b> as the keyword <b>let</b>.</p>
1108 <hr>
1109
1110 <h2>JavaScript and Camel Case</h2>
1111 <p>Historically, programmers have used different ways of joining multiple words into one variable name:</p>
1112 <p><strong>Hyphens:</strong></p>
1113 <p>first-name, last-name, master-card, inter-city.</p>
1114
1115 <div class="w3-panel w3-note">
1116 <p>Hyphens are not allowed in JavaScript. They are reserved for subtractions.</p>
1117 </div>
1118
1119 <p><strong>Underscore:</strong></p>
1120 <p>first_name, last_name, master_card, inter_city.</p>
1121 <p><strong>Upper Camel Case (Pascal Case):</strong></p>
1122 <p>FirstName, LastName, MasterCard, InterCity.</p>
1123 <p>
1124 <p><strong>Lower Camel Case:</strong></p>
1125 <p>JavaScript programmers tend to use camel case that starts with a lowercase letter:</p>
1126 <p>firstName, lastName, masterCard, interCity.</p>
1127
1128 <hr>
1129 <h2>JavaScript Character Set</h2>
1130 <p>JavaScript uses the <strong>Unicode</strong> character set.</p>
1131 <p>Unicode covers (almost) all the characters, punctuations, and symbols in the world.</p>
1132 <p>For a closer look, please study our <a href="/charsets/ref_html_utf8.asp">Complete Unicode Reference</a>.</p>
1133
1134 <br>
1135 <div class="w3-clear nextprev">
1136 <a class="w3-left w3-btn" href="js_statements.asp">&#10094; Previous</a>
1137 <a class="w3-right w3-btn" href="js_comments.asp">Next &#10095;</a>
1138 </div>
1139 <div id="mypagediv2" style="position:relative;text-align:center;"></div>
1140 <br>
1141
1142 </div>
1143 <div class="w3-col l2 m12" id="right">
1144
1145 <div class="sidesection">
1146 <div id="skyscraper">
1147
1148 <div id="adngin-sidebar_top-0"></div>
1149
1150 </div>
1151 </div>
1152
1153 <style>
1154 .ribbon-vid {
1155 font-size:12px;
1156 font-weight:bold;
1157 padding: 6px 20px;
1158 left:-20px;
1159 top:-10px;
1160 text-align: center;
1161 color:black;
1162 border-radius:25px;
1163 }
1164 </style>
1165
1166 <div class="sidesection" style="margin-top:20px;margin-bottom:20px;">
1167 <a id="upperfeatureshowcaselink" class="showcasebackend" href="https://www.w3schools.com/spaces/" target="_blank">
1168 <picture id="upperfeatureshowcase">
1169 <source id="upperfeatureshowcase3001" srcset="/images/img_backend_300.png" media="(max-width: 990px)" style="border-radius: 5px;">
1170 <source id="upperfeatureshowcase120" srcset="/images/img_backend_120.png" media="(max-width: 1260px)" style="border-radius: 5px;">
1171 <source id="upperfeatureshowcase160" srcset="/images/img_backend_160.png" media="(max-width: 1700px)" style="border-radius: 5px;">
1172 <img id="upperfeatureshowcase300" src="/images/img_backend_300.png" alt="Get started with your own server with Dynamic Spaces" style="width:auto;border
1173 </picture>
1174 </a>
1175 </div>
1176
1177 <div class="sidesection">
1178 <h4><a href="/colors/colors_picker.asp">COLOR PICKER</a></h4>
1179 <a href="/colors/colors_picker.asp">
1180 <img src="/images/colorpicker2000.png" alt="colorpicker" loading="lazy">
1181 </a>
1182 </div>
1183
1184 <div class="sidesection">
1185 <!--<h4>LIKE US</h4>-->
1186 <div class="sharethis">
1187 <a href="https://www.facebook.com/w3schoolscom/" target="_blank" title="Facebook"><span class="fa fa-facebook-square fa-2x"></span></a>
1188 <a href="https://www.instagram.com/w3schools.com_official/" target="_blank" title="Instagram"><span class="fa fa-instagram fa-2x"></span></a>
1189 <a href="https://www.linkedin.com/company/w3schools.com/" target="_blank" title="LinkedIn"><span class="fa fa-linkedin-square fa-2x"></span></a>
1190 <a href="https://discord.gg/6Z7UaRbUQM" target="_blank" title='Join the W3schools community on Discord'><span class="fa fa-discord fa-2x"></span></a>
1191 </div>
1192 </div>
1193
1194 <!--
1195 <div class="sidesection" style="border-radius:5px;color:#555;padding-top:1px;padding-bottom:8px;margin-left:auto;margin-right:auto;max-width:230px;backgr
1196 <p>Get your<br>certification today!</p>
1197 <a href="/cert/default.asp" target="_blank">
1198 <img src="/images/w3certified_logo_250.png" style="margin:0 12px 20px 10px;max-width:80%">
1199 </a>
1200 <a class="w3-btn w3-margin-bottom" style="text-decoration:none;border-radius:5px;"
1201 href="/cert/default.asp" target="_blank">View options</a>
1202 </div>
1203 -->
1204
1205 <style>
1206 #courses_get_started_btn {
1207 text-decoration:none !important;
1208 background-color:#04AA6D;
1209 width:100%;
1210 border-bottom-left-radius:5px;
1211 border-bottom-right-radius:5px;
1212 padding-top:10px;
1213 padding-bottom:10px;
1214 font-family: 'Source Sans Pro', sans-serif;
1215 }
1216 #courses_get_started_btn:hover {
1217 background-color:#059862!important;
1218 }
1219 </style>
1220 <div id="internalCourses" class="sidesection">
1221 <p style="font-size:18px;padding-left:2px;padding-right:2px;">Get certified<br>by completing<br><span id="courses_subject_text">a</span> course today!</p
1222 <a id="courses_subject_img_link" href="https://shop.w3schools.com/collections/course-catalog" target="_blank">
1223 <div style="padding:0 20px 20px 20px">
1224 <svg id="w3_cert_badge2" style="margin:auto;width:85%" data-name="w3_cert_badge2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><defs><style>.
1225 </div>
1226
1227 </a>
1228 <a class="w3-btn" id="courses_get_started_btn"
1229 href="https://shop.w3schools.com/collections/course-catalog" target="_blank">Get started</a>
1230 </div>
1231
1232 <div class="sidesection" id="moreAboutSubject">
1233 </div>
1234
1235 <div class="sidesection" style="margin-top:20px;margin-bottom:20px;">
1236 <a id="lowerfeatureshowcaselink" class="showcasesubs" href="https://www.w3schools.com/spaces/" target="_blank">
1237 <picture id="lowerfeatureshowcase">
1238 <source id="lowerfeatureshowcase3001" srcset="/images/img_subs_300.png" media="(max-width: 990px)" style="border-radius: 5px;">
1239 <source id="lowerfeatureshowcase120" srcset="/images/img_subs_120.png" media="(max-width: 1260px)" style="border-radius: 5px;">
1240 <source id="lowerfeatureshowcase160" srcset="/images/img_subs_160.png" media="(max-width: 1700px)" style="border-radius: 5px;">
1241 <img id="lowerfeatureshowcase300" src="/images/img_subs_300.png" alt="Subscribe" style="width:auto;border-radius: 5px;">
1242 </picture>
1243 </a>
1244 </div>
1245
1246 <script>
1247 var internalFeatureRnd = Math.floor(Math.random() * (5 - 1)) + 1;
1248 var upshowcase120 = document.getElementById("upperfeatureshowcase120");
1249 var upshowcase160 = document.getElementById("upperfeatureshowcase160");
1250 var upshowcase300 = document.getElementById("upperfeatureshowcase300");
1251 var upshowcase3001 = document.getElementById("upperfeatureshowcase3001");
1252 var upshowcaselink = document.getElementById("upperfeatureshowcaselink");
1253 var lowshowcase120 = document.getElementById("lowerfeatureshowcase120");
1254 var lowshowcase160 = document.getElementById("lowerfeatureshowcase160");
1255 var lowshowcase300 = document.getElementById("lowerfeatureshowcase300");
1256 var lowshowcase3001 = document.getElementById("lowerfeatureshowcase3001");
1257 var lowshowcaselink = document.getElementById("lowerfeatureshowcaselink");
1258
1259 if (internalFeatureRnd == 2) {
1260 upshowcase120.srcset = "/images/img_subs_120.png";
1261 upshowcase160.srcset = "/images/img_subs_160.png";
1262 upshowcase300.srcset = "/images/img_subs_300.png";
1263 upshowcase3001.srcset = "/images/img_subs_300.png";
1264 upshowcaselink.href = "https://www.w3schools.com/spaces/";
1265 upshowcaselink.classList.remove("showcasebackend");
1266 upshowcaselink.classList.add("showcaseupgrade");
1267 lowshowcase120.srcset = "/images/img_bootcamp_120.png";
1268 lowshowcase160.srcset = "/images/img_bootcamp_160.png";
1269 lowshowcase300.srcset = "/images/img_bootcamp_300.png";
1270 lowshowcase3001.srcset = "/images/img_bootcamp_300.png";
1271 lowshowcaselink.href = "https://www.w3schools.com/bootcamp/";
1272 lowshowcaselink.classList.remove("showcasesubs");
1273 lowshowcaselink.classList.add("showcasebootcamp");
1274 } else if (internalFeatureRnd == 3) {
1275 upshowcase120.srcset = "/images/img_bootcamp_120.png";
1276 upshowcase160.srcset = "/images/img_bootcamp_160.png";
1277 upshowcase300.srcset = "/images/img_bootcamp_300.png";
1278 upshowcase3001.srcset = "/images/img_bootcamp_300.png";
1279 upshowcaselink.href = "https://www.w3schools.com/bootcamp/";
1280 upshowcaselink.classList.remove("showcasebackend");
1281 upshowcaselink.classList.add("showcasebootcamp");
1282 lowshowcase120.srcset = "/images/img_fullaccess3_120.png";
1283 lowshowcase160.srcset = "/images/img_fullaccess3_160.png";
1284 lowshowcase300.srcset = "/images/img_fullaccess3_300.png";
1285 lowshowcase3001.srcset = "/images/img_fullaccess3_300.png";
1286 lowshowcaselink.href = "https://campus.w3schools.com/collections/course-catalog/products/w3schools-full-access-course";
1287 lowshowcaselink.classList.remove("showcasesubs");
1288 lowshowcaselink.classList.add("showcasefullaccess");
1289 } else if (internalFeatureRnd == 4) {
1290 upshowcase120.srcset = "/images/img_fullaccess3_120.png";
1291 upshowcase160.srcset = "/images/img_fullaccess3_160.png";
1292 upshowcase300.srcset = "/images/img_fullaccess3_300.png";
1293 upshowcase3001.srcset = "/images/img_fullaccess3_300.png";
1294 upshowcaselink.href = "https://campus.w3schools.com/collections/course-catalog/products/w3schools-full-access-course";
1295 upshowcaselink.classList.remove("showcasebackend");
1296 upshowcaselink.classList.add("showcasefullaccess");
1297 lowshowcase120.srcset = "/images/img_backend_120.png";
1298 lowshowcase160.srcset = "/images/img_backend_160.png";
1299 lowshowcase300.srcset = "/images/img_backend_300.png";
1300 lowshowcase3001.srcset = "/images/img_backend_300.png";
1301 lowshowcaselink.href = "https://www.w3schools.com/spaces/";
1302 lowshowcaselink.classList.remove("showcasesubs");
1303 lowshowcaselink.classList.add("showcasebackend");
1304 }
1305 function addTryitSpaces(subject) {
1306 let spacesButt = document.createElement("a");
1307 let ribb = document.createElement("span");
1308 spacesButt.innerHTML="Get your own " + subject + " Server"
1309 spacesButt.classList.add("ws-black", "ws-hover-black", "spaces-tryit");
1310 spacesButt.href="https://www.w3schools.com/spaces/";
1311 spacesButt.setAttribute("title", "W3Schools Spaces");
1312 spacesButt.setAttribute("target", "_blank");
1313
1314 var tryits = document.getElementsByClassName("w3-example");
1315 for (var i = 0; i < tryits.length; i++) {
1316 if (tryits[i].firstElementChild.nodeName == "H3") {
1317 tryits[i].firstElementChild.appendChild(spacesButt.cloneNode(true));
1318 break;
1319 }
1320 }
1321 }
1322
1323 switch (subjectFolder) {
1324 case "cpp":
1325 subjectText = "C++";
1326 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/c-course-1";
1327 break;
1328 case "java":
1329 subjectText = "Java";
1330 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/java-course";
1331 addTryitSpaces(subjectText);
1332 break;
1333 case "bootstrap4":
1334 subjectText = "Bootstrap 4";
1335 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/bootstrap-4-course";
1336 break;
1337 case "xml":
1338 subjectText = "XML";
1339 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/xml-course";
1340 break;
1341 case "jquery":
1342 subjectText = "jQuery";
1343 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/jquery-course";
1344 break;
1345 case "accessibility":
1346 subjectText = "Accessibility";
1347 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/accessibility-course";
1348 break;
1349 case "bootstrap":
1350 subjectText = "Bootstrap 3";
1351 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/bootstrap-course";
1352 break;
1353 case "html":
1354 subjectText = "HTML";
1355 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/html-course";
1356 break;
1357 case "tags":
1358 subjectText = "HTML";
1359 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/html-course";
1360 break;
1361 case "css":
1362 subjectText = "CSS";
1363 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/css-course";
1364 break;
1365 case "cssref":
1366 subjectText = "CSS";
1367 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/css-course";
1368 break;
1369 case "js":
1370 subjectText = "JavaScript";
1371 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/javascript-course";
1372 break;
1373 case "jsref":
1374 subjectText = "JavaScript";
1375 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/javascript-course";
1376 break;
1377 case "react":
1378 subjectText = "React.js";
1379 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/react-js-course";
1380 if (upshowcaselink.classList.contains("showcasebackend") == true) {
1381 upshowcase120.srcset = "/images/img_backend_120_react.png";
1382 upshowcase160.srcset = "/images/img_backend_160_react.png";
1383 upshowcase300.srcset = "/images/img_backend_300_react.png";
1384 upshowcase3001.srcset = "/images/img_backend_300_react.png";
1385 } else if (lowshowcaselink.classList.contains("showcasebackend") == true) {
1386 lowshowcase120.srcset = "/images/img_backend_120_react.png";
1387 lowshowcase160.srcset = "/images/img_backend_160_react.png";
1388 lowshowcase300.srcset = "/images/img_backend_300_react.png";
1389 lowshowcase3001.srcset = "/images/img_backend_300_react.png";
1390 }
1391 addTryitSpaces(subjectText);
1392 break;
1393 case "sql":
1394 subjectText = "SQL";
1395 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/sql-course";
1396 addTryitSpaces(subjectText);
1397 break;
1398 case "mysql":
1399 addTryitSpaces("SQL");
1400 break;
1401 case "php":
1402 subjectText = "PHP";
1403 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/php-course";
1404 if (upshowcaselink.classList.contains("showcasebackend") == true) {
1405 upshowcase120.srcset = "/images/img_backend_120_php.png";
1406 upshowcase160.srcset = "/images/img_backend_160_php.png";
1407 upshowcase300.srcset = "/images/img_backend_300_php.png";
1408 upshowcase3001.srcset = "/images/img_backend_300_php.png";
1409 } else if (lowshowcaselink.classList.contains("showcasebackend") == true) {
1410 lowshowcase120.srcset = "/images/img_backend_120_php.png";
1411 lowshowcase160.srcset = "/images/img_backend_160_php.png";
1412 lowshowcase300.srcset = "/images/img_backend_300_php.png";
1413 lowshowcase3001.srcset = "/images/img_backend_300_php.png";
1414 }
1415 addTryitSpaces(subjectText);
1416 break;
1417 case "cybersecurity":
1418 subjectText = "Cyber Security";
1419 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/cyber-security-course";
1420 break;
1421 case "r":
1422 subjectText = "R";
1423 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/r-course";
1424 break;
1425 case "numpy":
1426 subjectText = "Numpy";
1427 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/numpy-course";
1428 if (upshowcaselink.classList.contains("showcasebackend") == true) {
1429 upshowcase120.srcset = "/images/img_backend_120_numpy.png";
1430 upshowcase160.srcset = "/images/img_backend_160_numpy.png";
1431 upshowcase300.srcset = "/images/img_backend_300_numpy.png";
1432 upshowcase3001.srcset = "/images/img_backend_300_numpy.png";
1433 } else if (lowshowcaselink.classList.contains("showcasebackend") == true) {
1434 lowshowcase120.srcset = "/images/img_backend_120_numpy.png";
1435 lowshowcase160.srcset = "/images/img_backend_160_numpy.png";
1436 lowshowcase300.srcset = "/images/img_backend_300_numpy.png";
1437 lowshowcase3001.srcset = "/images/img_backend_300_numpy.png";
1438 }
1439 addTryitSpaces("Python");
1440 break;
1441 case "django":
1442 if (upshowcaselink.classList.contains("showcasebackend") == true) {
1443 upshowcase120.srcset = "/images/img_backend_120_django.png";
1444 upshowcase160.srcset = "/images/img_backend_160_django.png";
1445 upshowcase300.srcset = "/images/img_backend_300_django.png";
1446 upshowcase3001.srcset = "/images/img_backend_300_django.png";
1447 } else if (lowshowcaselink.classList.contains("showcasebackend") == true) {
1448 lowshowcase120.srcset = "/images/img_backend_120_django.png";
1449 lowshowcase160.srcset = "/images/img_backend_160_django.png";
1450 lowshowcase300.srcset = "/images/img_backend_300_django.png";
1451 lowshowcase3001.srcset = "/images/img_backend_300_django.png";
1452 }
1453 addTryitSpaces("Django");
1454 break;
1455 case "typescript":
1456 if (upshowcaselink.classList.contains("showcasebackend") == true) {
1457 upshowcase120.srcset = "/images/img_backend_120_ts.png";
1458 upshowcase160.srcset = "/images/img_backend_160_ts.png";
1459 upshowcase300.srcset = "/images/img_backend_300_ts.png";
1460 upshowcase3001.srcset = "/images/img_backend_300_ts.png";
1461 } else if (lowshowcaselink.classList.contains("showcasebackend") == true) {
1462 lowshowcase120.srcset = "/images/img_backend_120_ts.png";
1463 lowshowcase160.srcset = "/images/img_backend_160_ts.png";
1464 lowshowcase300.srcset = "/images/img_backend_300_ts.png";
1465 lowshowcase3001.srcset = "/images/img_backend_300_ts.png";
1466 }
1467 addTryitSpaces("TypeScript");
1468 break;
1469 case "nodejs":
1470 if (upshowcaselink.classList.contains("showcasebackend") == true) {
1471 upshowcase120.srcset = "/images/img_backend_120_node.png";
1472 upshowcase160.srcset = "/images/img_backend_160_node.png";
1473 upshowcase300.srcset = "/images/img_backend_300_node.png";
1474 upshowcase3001.srcset = "/images/img_backend_300_node.png";
1475 } else if (lowshowcaselink.classList.contains("showcasebackend") == true) {
1476 lowshowcase120.srcset = "/images/img_backend_120_node.png";
1477 lowshowcase160.srcset = "/images/img_backend_160_node.png";
1478 lowshowcase300.srcset = "/images/img_backend_300_node.png";
1479 lowshowcase3001.srcset = "/images/img_backend_300_node.png";
1480 }
1481 addTryitSpaces("Node.js");
1482 break;
1483 case "pandas":
1484 subjectText = "Pandas";
1485 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/pandas-course";
1486 if (upshowcaselink.classList.contains("showcasebackend") == true) {
1487 upshowcase120.srcset = "/images/img_backend_120_pandas.png";
1488 upshowcase160.srcset = "/images/img_backend_160_pandas.png";
1489 upshowcase300.srcset = "/images/img_backend_300_pandas.png";
1490 upshowcase3001.srcset = "/images/img_backend_300_pandas.png";
1491 } else if (lowshowcaselink.classList.contains("showcasebackend") == true) {
1492 lowshowcase120.srcset = "/images/img_backend_120_pandas.png";
1493 lowshowcase160.srcset = "/images/img_backend_160_pandas.png";
1494 lowshowcase300.srcset = "/images/img_backend_300_pandas.png";
1495 lowshowcase3001.srcset = "/images/img_backend_300_pandas.png";
1496 }
1497 addTryitSpaces("Python");
1498 break;
1499 case "python":
1500 subjectText = "Python";
1501 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/python-course";
1502 if (upshowcaselink.classList.contains("showcasebackend") == true) {
1503 upshowcase120.srcset = "/images/img_backend_120_python.png";
1504 upshowcase160.srcset = "/images/img_backend_160_python.png";
1505 upshowcase300.srcset = "/images/img_backend_300_python.png";
1506 upshowcase3001.srcset = "/images/img_backend_300_python.png";
1507 } else if (lowshowcaselink.classList.contains("showcasebackend") == true) {
1508 lowshowcase120.srcset = "/images/img_backend_120_python.png";
1509 lowshowcase160.srcset = "/images/img_backend_160_python.png";
1510 lowshowcase300.srcset = "/images/img_backend_300_python.png";
1511 lowshowcase3001.srcset = "/images/img_backend_300_python.png";
1512 }
1513 addTryitSpaces(subjectText);
1514 break;
1515 case "cs":
1516 subjectText = "C#";
1517 subjectLink = "https://shop.w3schools.com/collections/course-catalog/products/c-course";
1518 addTryitSpaces(subjectText);
1519 break;
1520 default:
1521 subjectText = "a";
1522 subjectLink = "https://shop.w3schools.com/collections/course-catalog";
1523 }
1524 if (typeof subjectText == 'undefined') {
1525 subjectText = "a";
1526 subjectLink = "https://shop.w3schools.com/collections/course-catalog";
1527 }
1528 if (subjectText != "a") {
1529 document.getElementById("courses_subject_text").innerHTML = "a " + subjectText + "<br>";
1530 document.getElementById("courses_subject_img_link").href = subjectLink;
1531 document.getElementById("courses_get_started_btn").href = subjectLink;
1532 }
1533 </script>
1534
1535
1536 <div id="stickypos" class="sidesection" style="text-align:center;position:sticky;top:50px;">
1537 <div id="stickyadcontainer">
1538 <div style="position:relative;margin:auto;">
1539
1540 <div id="adngin-sidebar_sticky-0"></div>
1541 <script>
1542 function secondSnigel() {
1543 if(window.adngin && window.adngin.adnginLoaderReady) {
1544 if (Number(w3_getStyleValue(document.getElementById("main"), "height").replace("px", "")) > 2200) {
1545 if (document.getElementById("adngin-mid_content-0")) {
1546 adngin.queue.push(function(){ adngin.cmd.startAuction(["sidebar_sticky", "mid_content" ]); });
1547 } else {
1548 adngin.queue.push(function(){ adngin.cmd.startAuction(["sidebar_sticky"]); });
1549 }
1550 } else {
1551 if (document.getElementById("adngin-mid_content-0")) {
1552 adngin.queue.push(function(){ adngin.cmd.startAuction(["mid_content"]); });
1553 }
1554 }
1555 } else {
1556 window.addEventListener('adnginLoaderReady', function() {
1557 if (Number(w3_getStyleValue(document.getElementById("main"), "height").replace("px", "")) > 2200) {
1558 if (document.getElementById("adngin-mid_content-0")) {
1559 adngin.queue.push(function(){ adngin.cmd.startAuction(["sidebar_sticky", "mid_content" ]); });
1560 } else {
1561 adngin.queue.push(function(){ adngin.cmd.startAuction(["sidebar_sticky"]); });
1562 }
1563 } else {
1564 if (document.getElementById("adngin-mid_content-0")) {
1565 adngin.queue.push(function(){ adngin.cmd.startAuction(["mid_content"]); });
1566 }
1567 }
1568 });
1569 }
1570 }
1571 </script>
1572
1573 </div>
1574 </div>
1575 </div>
1576
1577 <script>
1578 uic_r_c()
1579 </script>
1580
1581 </div>
1582 </div>
1583 <div id="footer" class="footer w3-container w3-white">
1584
1585 <hr>
1586
1587 <div style="overflow:auto">
1588 <div class="bottomad">
1589 <!-- BottomMediumRectangle -->
1590 <!--<pre>bottom_medium_rectangle, all: [970,250][300,250][336,280]</pre>-->
1591 <div id="adngin-bottom_left-0" style="padding:0 10px 10px 0;float:left;width:auto;"></div>
1592 <!-- adspace bmr -->
1593 <!-- RightBottomMediumRectangle -->
1594 <!--<pre>right_bottom_medium_rectangle, desktop: [300,250][336,280]</pre>-->
1595 <div id="adngin-bottom_right-0" style="padding:0 10px 10px 0;float:left;width:auto;"></div>
1596 </div>
1597 </div>
1598
1599 <hr>
1600 <div class="w3-row-padding w3-center w3-small" style="margin:auto">
1601 <div class="w3-col m12 w3-hide-medium w3-hide-small" style="width:20%">
1602 <a class="w3-btn ws-black w3-block w3-round" href="javascript:void(0);" onclick="displayError();return false" style="white-space:nowrap;text-decorati
1603 </div>
1604 <div class="w3-col m12 w3-hide-large">
1605 <a class="w3-btn ws-black w3-block w3-round" href="javascript:void(0);" onclick="displayError();return false" style="white-space:nowrap;text-decorati
1606 </div>
1607
1608
1609 <div class="w3-col m12 w3-hide-medium w3-hide-small" style="width:20%">
1610 <a class="w3-btn ws-black w3-block w3-round" href="/spaces/index.html" style="text-decoration:none;margin-top:1px;margin-bottom:1px;font-size:17px;fo
1611 </div>
1612 <div class="w3-col m12 w3-hide-large">
1613 <a class="w3-btn ws-black w3-block w3-round" href="/spaces/index.html" style="text-decoration:none;margin-top:1px;margin-bottom:1px;font-size:17px;fo
1614 </div>
1615
1616
1617 <div class="w3-col m12 w3-hide-medium w3-hide-small" style="width:20%">
1618 <a class="w3-btn ws-black w3-block w3-round" href="/pro/index.php" style="text-decoration:none;margin-top:1px;margin-bottom:1px;font-size:17px;font-f
1619 </div>
1620 <div class="w3-col m12 w3-hide-large">
1621 <a class="w3-btn ws-black w3-block w3-round" href="/pro/index.php" style="text-decoration:none;margin-top:1px;margin-bottom:1px;font-size:17px;font-f
1622 </div>
1623
1624 <div class="w3-col m12 w3-hide-medium w3-hide-small" style="width:20%">
1625 <a class="w3-btn ws-black w3-block w3-round" href="https://campus.w3schools.com/pages/newsletter" target="_blank" style="white-space:nowrap;text-deco
1626 </div>
1627 <div class="w3-col m12 w3-hide-large">
1628 <a class="w3-btn ws-black w3-block w3-round" href="https://campus.w3schools.com/pages/newsletter" target="_blank" style="white-space:nowrap;text-deco
1629 </div>
1630
1631
1632 <div class="w3-col m12 w3-hide-medium w3-hide-small" style="width:20%">
1633 <a class="w3-btn ws-black w3-block w3-round" href="https://shop.w3schools.com/collections/certifications" target="_blank" style="text-decoration:none
1634 </div>
1635
1636 <div class="w3-col m12 w3-hide-large">
1637 <a class="w3-btn ws-black w3-block w3-round" href="https://shop.w3schools.com/collections/certifications" target="_blank" style="text-decoration:none
1638 </div>
1639 </div>
1640
1641 <hr>
1642 <div class="ws-grey w3-padding w3-margin-bottom" id="err_form" style="display:none;position:relative">
1643 <span onclick="this.parentElement.style.display='none'" class="w3-button w3-display-topright w3-large">&times;</span>
1644
1645 <h2>Report Error</h2>
1646
1647 <p>If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:</p>
1648 <p>help@w3schools.com</p>
1649 <br>
1650
1651 <!--
1652 <h2>Your Suggestion:</h2>
1653 <form>
1654 <div class="w3-section">
1655 <label for="err_email">Your E-mail:</label>
1656 <input class="w3-input w3-border" type="text" style="margin-top:5px;width:100%" id="err_email" name="err_email">
1657 </div>
1658 <div class="w3-section">
1659 <label for="err_email">Page address:</label>
1660 <input class="w3-input w3-border" type="text" style="width:100%;margin-top:5px" id="err_url" name="err_url" disabled="disabled">
1661 </div>
1662 <div class="w3-section">
1663 <label for="err_email">Description:</label>
1664 <textarea rows="10" class="w3-input w3-border" id="err_desc" name="err_desc" style="width:100%;margin-top:5px;resize:vertical;"></textarea>
1665 </div>
1666 <div class="form-group">
1667 <button type="button" class="w3-button w3-dark-grey" onclick="sendErr()">Submit</button>
1668 </div>
1669 <br>
1670 </form>
1671 -->
1672
1673 </div>
1674 <div class="w3-container ws-grey w3-padding" id="err_sent" style="display:none;position:relative">
1675 <span onclick="this.parentElement.style.display='none'" class="w3-button w3-display-topright">&times;</span>
1676 <h2>Thank You For Helping Us!</h2>
1677 <p>Your message has been sent to W3Schools.</p>
1678 </div>
1679
1680 <div class="w3-row w3-center w3-small">
1681 <div class="w3-col l3 m6 s12">
1682 <div class="top10">
1683 <h5 style="font-family: 'Source Sans Pro', sans-serif;">Top Tutorials</h5>
1684 <a href="/html/default.asp">HTML Tutorial</a><br>
1685 <a href="/css/default.asp">CSS Tutorial</a><br>
1686 <a href="/js/default.asp">JavaScript Tutorial</a><br>
1687 <a href="/howto/default.asp">How To Tutorial</a><br>
1688 <a href="/sql/default.asp">SQL Tutorial</a><br>
1689 <a href="/python/default.asp">Python Tutorial</a><br>
1690 <a href="/w3css/default.asp">W3.CSS Tutorial</a><br>
1691 <a href="/bootstrap/bootstrap_ver.asp">Bootstrap Tutorial</a><br>
1692 <a href="/php/default.asp">PHP Tutorial</a><br>
1693 <a href="/java/default.asp">Java Tutorial</a><br>
1694 <a href="/cpp/default.asp">C++ Tutorial</a><br>
1695 <a href="/jquery/default.asp">jQuery Tutorial</a><br>
1696 </div>
1697 </div>
1698 <div class="w3-col l3 m6 s12">
1699 <div class="top10">
1700 <h5 style="font-family: 'Source Sans Pro', sans-serif;">Top References</h5>
1701 <a href="/tags/default.asp">HTML Reference</a><br>
1702 <a href="/cssref/index.php">CSS Reference</a><br>
1703 <a href="/jsref/default.asp">JavaScript Reference</a><br>
1704 <a href="/sql/sql_ref_keywords.asp">SQL Reference</a><br>
1705 <a href="/python/python_reference.asp">Python Reference</a><br>
1706 <a href="/w3css/w3css_references.asp">W3.CSS Reference</a><br>
1707 <a href="/bootstrap/bootstrap_ref_all_classes.asp">Bootstrap Reference</a><br>
1708 <a href="/php/php_ref_overview.asp">PHP Reference</a><br>
1709 <a href="/colors/colors_names.asp">HTML Colors</a><br>
1710 <a href="/java/java_ref_keywords.asp">Java Reference</a><br>
1711 <a href="/angular/angular_ref_directives.asp">Angular Reference</a><br>
1712 <a href="/jquery/jquery_ref_overview.asp">jQuery Reference</a><br>
1713 </div>
1714 </div>
1715 <div class="w3-col l3 m6 s12">
1716 <div class="top10">
1717 <h5 style="font-family: 'Source Sans Pro', sans-serif;">Top Examples</h5>
1718 <a href="/html/html_examples.asp">HTML Examples</a><br>
1719 <a href="/css/css_examples.asp">CSS Examples</a><br>
1720 <a href="/js/js_examples.asp">JavaScript Examples</a><br>
1721 <a href="/howto/default.asp">How To Examples</a><br>
1722 <a href="/sql/sql_examples.asp">SQL Examples</a><br>
1723 <a href="/python/python_examples.asp">Python Examples</a><br>
1724 <a href="/w3css/w3css_examples.asp">W3.CSS Examples</a><br>
1725 <a href="/bootstrap/bootstrap_examples.asp">Bootstrap Examples</a><br>
1726 <a href="/php/php_examples.asp">PHP Examples</a><br>
1727 <a href="/java/java_examples.asp">Java Examples</a><br>
1728 <a href="/xml/xml_examples.asp">XML Examples</a><br>
1729 <a href="/jquery/jquery_examples.asp">jQuery Examples</a><br>
1730 </div>
1731 </div>
1732 <div class="w3-col l3 m6 s12">
1733 <div class="top10">
1734 <!--
1735 <h4>Web Certificates</h4>
1736 <a href="/cert/default.asp">HTML Certificate</a><br>
1737 <a href="/cert/default.asp">CSS Certificate</a><br>
1738 <a href="/cert/default.asp">JavaScript Certificate</a><br>
1739 <a href="/cert/default.asp">SQL Certificate</a><br>
1740 <a href="/cert/default.asp">Python Certificate</a><br>
1741 <a href="/cert/default.asp">PHP Certificate</a><br>
1742 <a href="/cert/default.asp">Bootstrap Certificate</a><br>
1743 <a href="/cert/default.asp">XML Certificate</a><br>
1744 <a href="/cert/default.asp">jQuery Certificate</a><br>
1745 <a href="//www.w3schools.com/cert/default.asp" class="w3-button w3-margin-top w3-dark-grey" style="text-decoration:none">
1746 Get Certified &raquo;</a>
1747 -->
1748
1749 <a href="https://shop.w3schools.com/collections/course-catalog" target="_blank"><h5 style="font-family: 'Source Sans Pro', sans-serif;">Get Certified</h5
1750 <a href="https://campus.w3schools.com/collections/certifications/products/html-certificate" target="_blank">HTML Certificate</a><br>
1751 <a href="https://campus.w3schools.com/collections/certifications/products/css-certificate" target="_blank">CSS Certificate</a><br>
1752 <a href="https://campus.w3schools.com/collections/certifications/products/javascript-certificate" target="_blank">JavaScript Certificate</a><br>
1753 <a href="https://campus.w3schools.com/collections/certifications/products/front-end-certificate" target="_blank">Front End Certificate</a><br>
1754 <a href="https://campus.w3schools.com/collections/certifications/products/sql-certificate" target="_blank">SQL Certificate</a><br>
1755 <a href="https://campus.w3schools.com/collections/certifications/products/python-certificate" target="_blank">Python Certificate</a><br>
1756 <a href="https://campus.w3schools.com/collections/certifications/products/php-certificate" target="_blank">PHP Certificate</a><br>
1757 <a href="https://campus.w3schools.com/collections/certifications/products/jquery-certificate" target="_blank">jQuery Certificate</a><br>
1758 <a href="https://campus.w3schools.com/collections/certifications/products/java-certificate" target="_blank">Java Certificate</a><br>
1759 <a href="https://campus.w3schools.com/collections/certifications/products/c-certificate" target="_blank">C++ Certificate</a><br>
1760 <a href="https://campus.w3schools.com/collections/certifications/products/c-certificate-1" target="_blank">C# Certificate</a><br>
1761 <a href="https://campus.w3schools.com/collections/certifications/products/xml-certificate" target="_blank">XML Certificate</a><br>
1762 <!--<a href="https://shop.w3schools.com/collections/course-catalog" target="_blank" class="w3-button w3-margin-top ws-black ws-hover-black w3-round" styl
1763 Get Certified &#10095;</a>-->
1764
1765 </div>
1766 </div>
1767 </div>
1768
1769 <hr>
1770 <div class="w3-opacity" style="font-size:12px;text-align:right;margin-bottom:16px;margin-right:8px;">
1771 <a href="/forum/default.asp" target="_blank" class="xw3-text-grey xw3-hover-text-black" style="text-decoration:none" title="Forum">FORUM</a> |
1772 <a href="/about/default.asp" target="_top" class="xw3-text-grey xw3-hover-text-black" style="text-decoration:none" title="About W3Schools">ABOUT</a>
1773 </div>
1774 <div class="w3-center w3-small w3-opacity">
1775 W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning.
1776 Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content.
1777 While using W3Schools, you agree to have read and accepted our <a href="/about/about_copyright.asp">terms of use</a>,
1778 <a href="/about/about_privacy.asp">cookie and privacy policy</a>.<br><br>
1779 <a href="/about/about_copyright.asp">Copyright 1999-2023</a> by Refsnes Data. All Rights Reserved.<br>
1780 <a href="//www.w3schools.com/w3css/default.asp">W3Schools is Powered by W3.CSS</a>.<br><br>
1781 </div>
1782 <div class="w3-center w3-small">
1783 <a href="//www.w3schools.com">
1784 <i class="fa fa-logo ws-text-green ws-hover-text-green" style="position:relative;font-size:42px!important;"></i>
1785 </div>
1786 <br><br>
1787 </div>
1788 </div>
1789 <script src="/lib/w3schools_footer.js?update=20220202"></script>
1790
1791 <script>
1792 MyLearning.loadUser('footer', function () {
1793 if (UserSession.loggedIn) {
1794 document.getElementById("signupbtn_topnav").style.display = "none";
1795 document.getElementById("spacesbtn_topnav").style.display = "block";
1796 } else {
1797 addMyLearnButt();
1798 }
1799 });
1800 function docReady(fn) {
1801 document.addEventListener("DOMContentLoaded", fn);
1802 if (document.readyState === "interactive" || document.readyState === "complete" ) {
1803 fn();
1804 }
1805 }
1806 uic_r_z();
1807 uic_r_d()
1808
1809 function addMyLearnButt() {
1810 let nav = document.getElementsByClassName("nextprev");
1811 if (document.body.contains(nav[1])) {
1812 if ((nav[1].firstElementChild.innerHTML.indexOf("Previous") || nav[1].firstElementChild.innerHTML.indexOf("Home") !== -1) && (nav[1].firstElementChil
1813 let myLearnButt = document.createElement("a");
1814 myLearnButt.innerHTML="Log in to track progress";
1815 myLearnButt.classList.add("w3-btn", "w3-hide-small", "myl-nav-butt");
1816 myLearnButt.href="https://www.w3schools.com/signup/?utm_source=classic&utm_medium=" + subjectFolder + "_tutorial&utm_campaign=button_lower_navigati
1817 myLearnButt.setAttribute("title", "Sign Up and improve Your Learning Experience");
1818 myLearnButt.setAttribute("target", "_blank");
1819 nav[1].classList.add("w3-center");
1820 nav[1].firstElementChild.insertAdjacentElement("afterend", myLearnButt);
1821 }
1822 }
1823 }
1824 </script>
1825
1826 <!--[if lt IE 9]>
1827 <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
1828 <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
1829 <![endif]-->
1830 </body>
1831 </html>
1832

You might also like