<label id="lafyy"></label><li id="lafyy"><legend id="lafyy"></legend></li>

<rt id="lafyy"><delect id="lafyy"><style id="lafyy"></style></delect></rt>
  • <rt id="lafyy"><noframes id="lafyy">
    1. <bdo id="lafyy"></bdo>
      \n
      <\/div>\n
      <\/div>\n \n \n<\/body>\n<\/html><\/pre>\n

      As you can see, this code uses CDN to include CSS and JavaScript files. Therefore, you have to update the link to include the files you downloaded earlier. In the mark, you can see some

      <\/code> placed. The first one has qunit as its ID, used by the framework to display its user interface, where the test results are displayed. The second
      <\/code>, whose ID is qunit-fixture, should be used by you (the developer). This element allows developers to test code that adds, edits, or removes elements from the DOM without worrying about cleaning up the DOM after each test. If you put the element you created by your code in this
      <\/code>, QUnit will handle the reset for us. Finally, we include a tests.js file that represents the file containing the tests. My advice is to use files to store tests when working with real projects. In the live demo I created for this tutorial, I used JSBin and certainly did not allow uploading of files. So in the demo, you'll see that I've inlined the test code. Now that you understand what it means to tag each section, open the index.html page in your browser to see what happens. If all goes well, you should see a live demo interface as shown below, which is also provided as JSBin: QUnit example. At this stage, the only part of this interface that is relevant to us is the part that shows the time QUnit spends processing tests, the number of assertions defined, and the number of tests passed and failed. The above demonstration shows that we do not define any tests. Let's solve this problem. <\/p>\n

      How to create tests using QUnit<\/strong><\/p>\n

      QUnit provides two ways to create new tests: QUnit.test()<\/code> and QUnit.asyncTest()<\/code>. The first one is used to test code running synchronously, while the second one is used to test asynchronous code. In this section, I will describe how to create tests for synchronous code. The signature of the QUnit.test()<\/code> method is as follows: <\/p>\n

      QUnit.test(name, testFunction)<\/pre>\n

      The first parameter name<\/code> is a string that helps us identify the created tests. The second parameter testFunction<\/code> is a function that contains the assertions the framework will execute. The framework passes a parameter to this function that exposes all QUnit's assertion methods. Convert this description to code, we can update the tests.js file with the following code: <\/p>\n

      QUnit.test('我的第一個測試', function(assert) {\n   \/\/ 斷言在這里...\n});<\/pre>\n

      This code creates a new test identified by the string \"My First Test\" and a function with an empty body. Adding tests without any assertions is of no use. To solve this problem, we must learn the assertion methods available in QUnit. <\/p>\n

      QUnit's assertion method<\/strong><\/p>\n

      Assertions are at the heart of software testing. They allow us to verify that our code works as expected. In QUnit, we have many ways to verify these expectations. They can be accessed in tests by parameters of functions passed to the QUnit.test()<\/code> method (in our previous example, assert<\/code>). The following list summarizes the available methods, as well as their functions and signatures: <\/p>

        \n
      • deepEqual(value, expected[, message])<\/code>: A recursive strict comparison that works for all JavaScript types. If value<\/code> and expected<\/code> are the same in terms of properties and values, and have the same prototype, the assertion is passed; <\/li>\n
      • equal(value, expected[, message])<\/code>: The value<\/code> equals expected<\/code> parameter provided using non-strict comparison (==) verification. <\/li>\n
      • notDeepEqual(value, expected[, message])<\/code>: Same as deepEqual()<\/code>, but tests inequality; <\/li>\n
      • notEqual(value, expected[, message])<\/code>: Same as equal()<\/code>, but tests inequality; <\/li>\n
      • propEqual(value, expected[, message])<\/code>: Strict comparison of the properties and values ??of an object. If all attributes and values ??are the same, the assertion passes; <\/li>\n
      • strictEqual(value, expected[, message])<\/code>: Use strict comparison (===) verification to provide the value<\/code> parameter equal to the expected<\/code>; <\/li>\n
      • notPropEqual(value, expected[, message])<\/code>: Same as propEqual()<\/code>, but tests inequality; <\/li>\n
      • notStrictEqual(value, expected[, message])<\/code>: Same as strictEqual()<\/code>, but tests inequality; <\/li>\n
      • ok(value[, message])<\/code>: If the first parameter is a true value, the assertion passes; <\/li>\n
      • throws(function[, expected][, message])<\/code>: Test whether the callback throws an exception and optionally compare the thrown errors; <\/li>\n<\/ul>\n

        The parameters accepted by these methods are as follows: <\/p>\n

          \n
        • value<\/code>: The value returned by a function, method, or the value stored in a variable that must be verified; <\/li>\n
        • expected<\/code>: The value to be tested. For the throws()<\/code> method, this can be Error 對象(實例)、Error 函數(shù)(構(gòu)造函數(shù))、與字符串表示匹配(或部分匹配)的正則表達(dá)式或必須返回 true 以通過斷言檢查的回調(diào)函數(shù)<\/q><\/code>; <\/li>\n
        • message<\/code>: an optional string describing the assertion; <\/li>\n
        • function<\/code>: The function to be executed should return an Error; <\/li>\n<\/ul>\n

          Now that you have understood the methods and parameters available, it's time to check out some code. Instead of writing multiple tests for a single function, I try to reproduce a more realistic example. Anyway, the tests I will show you should not be considered a complete test suite, but they should give you a specific idea of ??where to start. In order to write the mentioned tests, we need to define some code to test. In this case, I will define an object literal like this: <\/p>

          \n\n\n  \n  QUnit Example<\/title>\n  <link rel=\"stylesheet\" href=\"qunit-1.14.0.css\">\n<\/head>\n<body>
          <h1><a href="http://www.miracleart.cn/">国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂</a></h1>\n  <div   class="377j5v51b"   id=\"qunit\"><\/div>\n  <div   class="377j5v51b"   id=\"qunit-fixture\"><\/div>\n  <??>\n  <??>\n<\/body>\n<\/html><\/pre>\n<p> As you can see, we define an object literal with three functions: <code>max()<\/code>, <code>isOdd()<\/code>, and <code>sortObj()<\/code>. The first one accepts any number of parameters and returns the maximum value. <code>isOdd()<\/code> Take a number as its parameter and test if it is an odd number. <code>sortObj()<\/code> Accepts an array of objects, ideally there should be an attribute named timestamp and sorts them according to the value of this attribute. The possible test sets of these functions are as follows: (The lengthy test code example is omitted here because the word limit has been exceeded, but the principle is consistent with the previous description) <\/p>\n<p><strong>Set expectations<\/strong><\/p>\n<p> When creating a test, the best practice is to set the number of assertions we expect to execute. Doing so, if one or more assertions are not executed, the test will fail. The QUnit framework provides a <code>expect()<\/code> method for this purpose. This method is especially useful when dealing with asynchronous code, but it is best to use it when testing synchronous functions. The signature of the <code>expect()<\/code> method is as follows: <\/p>\n<pre class='brush:php;toolbar:false;'>QUnit.test(name, testFunction)<\/pre>\nThe <p>where the <code>assertionsNumber<\/code> parameter specifies the expected number of assertions. (The example of updating the test code is also omitted here because the word limit has been exceeded, but the principle is consistent with the previous description) <\/p>\n<p><strong>QUnit Introduction Conclusion<\/strong><\/p>\n<p>In this tutorial, I introduce you to the magical world of testing, especially how to unit test JavaScript code using QUnit. We've seen how easy it is to set up the QUnit framework and what methods it provides to test synchronization functions. In addition, you have also learned the set of assertion functions provided by the framework for testing the code. Finally, I mentioned the importance of setting the number of assertions we expect to run and how to set them using the <code>expect()<\/code> method. I hope you enjoyed this post and you will consider integrating QUnit into your project. (The FAQs part is omitted here because the word limit has been exceeded) <\/p>"}	</script>
          	
          <meta http-equiv="Cache-Control" content="no-transform" />
          <meta http-equiv="Cache-Control" content="no-siteapp" />
          <script>var V_PATH="/";window.onerror=function(){ return true; };</script>
          </head>
          
          <body data-commit-time="2023-12-28T14:50:12+08:00" class="editor_body body2_2">
          	<link rel="stylesheet" type="text/css" href="/static/csshw/stylehw.css">
          <header>
              <div   id="377j5v51b"   class="head">
                  <div   id="377j5v51b"   class="haed_left">
                      <div   id="377j5v51b"   class="haed_logo">
                          <a href="http://www.miracleart.cn/" title="" class="haed_logo_a">
                              <img src="/static/imghw/logo.png" alt="" class="haed_logoimg">
                          </a>
                      </div>
                      <div   id="377j5v51b"   class="head_nav">
                          <div   id="377j5v51b"   class="head_navs">
                              <a href="javascript:;" title="Community" class="head_nava head_nava-template1">Community</a>
                              <div   class="377j5v51b"   id="dropdown-template1" style="display: none;">
                                  <div   id="377j5v51b"   class="languagechoose">
                                      <a href="http://www.miracleart.cn/article.html" title="Articles" class="languagechoosea on">Articles</a>
                                      <a href="http://www.miracleart.cn/faq/zt" title="Topics" class="languagechoosea">Topics</a>
                                      <a href="http://www.miracleart.cn/wenda.html" title="Q&A" class="languagechoosea">Q&A</a>
                                  </div>
                              </div>
                          </div>
          
                          <div   id="377j5v51b"   class="head_navs">
                              <a href="javascript:;" title="Learn" class="head_nava head_nava-template1_1">Learn</a>
                              <div   class="377j5v51b"   id="dropdown-template1_1" style="display: none;">
                                  <div   id="377j5v51b"   class="languagechoose">
                                      <a href="http://www.miracleart.cn/course.html" title="Course" class="languagechoosea on">Course</a>
                                      <a href="http://www.miracleart.cn/dic/" title="Programming Dictionary" class="languagechoosea">Programming Dictionary</a>
                                  </div>
                              </div>
                          </div>
          
                          <div   id="377j5v51b"   class="head_navs">
                              <a href="javascript:;" title="Tools Library" class="head_nava head_nava-template1_2">Tools Library</a>
                              <div   class="377j5v51b"   id="dropdown-template1_2" style="display: none;">
                                  <div   id="377j5v51b"   class="languagechoose">
                                      <a href="http://www.miracleart.cn/toolset/development-tools" title="Development tools" class="languagechoosea on">Development tools</a>
                                      <a href="http://www.miracleart.cn/toolset/website-source-code" title="Website Source Code" class="languagechoosea">Website Source Code</a>
                                      <a href="http://www.miracleart.cn/toolset/php-libraries" title="PHP Libraries" class="languagechoosea">PHP Libraries</a>
                                      <a href="http://www.miracleart.cn/toolset/js-special-effects" title="JS special effects" class="languagechoosea on">JS special effects</a>
                                      <a href="http://www.miracleart.cn/toolset/website-materials" title="Website Materials" class="languagechoosea on">Website Materials</a>
                                      <a href="http://www.miracleart.cn/toolset/extension-plug-ins" title="Extension plug-ins" class="languagechoosea on">Extension plug-ins</a>
                                  </div>
                              </div>
                          </div>
          
                          <div   id="377j5v51b"   class="head_navs">
                              <a href="http://www.miracleart.cn/ai" title="AI Tools" class="head_nava head_nava-template1_3">AI Tools</a>
                          </div>
          
                          <div   id="377j5v51b"   class="head_navs">
                              <a href="javascript:;" title="Leisure" class="head_nava head_nava-template1_3">Leisure</a>
                              <div   class="377j5v51b"   id="dropdown-template1_3" style="display: none;">
                                  <div   id="377j5v51b"   class="languagechoose">
                                      <a href="http://www.miracleart.cn/game" title="Game Download" class="languagechoosea on">Game Download</a>
                                      <a href="http://www.miracleart.cn/mobile-game-tutorial/" title="Game Tutorials" class="languagechoosea">Game Tutorials</a>
          
                                  </div>
                              </div>
                          </div>
                      </div>
                  </div>
                              <div   id="377j5v51b"   class="head_search">
                          <input id="key_words"  onkeydown="if (event.keyCode == 13) searchs('en')" class="search-input" type="text" autocomplete="off" name="keywords" required="required" placeholder="Block,address,transaction,news" value="">
                          <a href="javascript:;" title="search"  onclick="searchs('en')"><img src="/static/imghw/find.png" alt="search"></a>
                      </div>
                          <div   id="377j5v51b"   class="head_right">
                      <div   id="377j5v51b"   class="haed_language">
                          <a href="javascript:;" class="layui-btn haed_language_btn">English<i class="layui-icon layui-icon-triangle-d"></i></a>
                          <div   class="377j5v51b"   id="dropdown-template" style="display: none;">
                              <div   id="377j5v51b"   class="languagechoose">
                                                          <a href="javascript:setlang('zh-cn');" title="簡體中文" class="languagechoosea">簡體中文</a>
                                                          <a href="javascript:;" title="English" class="languagechoosea">English</a>
                                                          <a href="javascript:setlang('zh-tw');" title="繁體中文" class="languagechoosea">繁體中文</a>
                                                          <a href="javascript:setlang('ja');" title="日本語" class="languagechoosea">日本語</a>
                                                          <a href="javascript:setlang('ko');" title="???" class="languagechoosea">???</a>
                                                          <a href="javascript:setlang('ms');" title="Melayu" class="languagechoosea">Melayu</a>
                                                          <a href="javascript:setlang('fr');" title="Fran?ais" class="languagechoosea">Fran?ais</a>
                                                          <a href="javascript:setlang('de');" title="Deutsch" class="languagechoosea">Deutsch</a>
                                                      </div>
                          </div>
                      </div>
                      <span id="377j5v51b"    class="head_right_line"></span>
                                      <div style="display: block;" id="login" class="haed_login ">
                              <a href="javascript:;"  title="Login" class="haed_logina ">Login</a>
                          </div>
                          <div style="display: block;" id="reg" class="head_signup login">
                              <a href="javascript:;"  title="singup" class="head_signupa">singup</a>
                          </div>
                      
                  </div>
              </div>
          </header>
          
          	
          	<main>
          		<div   id="377j5v51b"   class="Article_Details_main">
          			<div   id="377j5v51b"   class="Article_Details_main1">
          							<div   id="377j5v51b"   class="Article_Details_main1M">
          					<div   id="377j5v51b"   class="phpgenera_Details_mainL1">
          						<a href="http://www.miracleart.cn/" title="Home"
          							class="phpgenera_Details_mainL1a">Home</a>
          						<img src="/static/imghw/top_right.png" alt="" />
          												<a href="http://www.miracleart.cn/web-designer.html"
          							class="phpgenera_Details_mainL1a">Web Front-end</a>
          						<img src="/static/imghw/top_right.png" alt="" />
          												<a href="http://www.miracleart.cn/js-tutorial.html"
          							class="phpgenera_Details_mainL1a">JS  Tutorial</a>
          						<img src="/static/imghw/top_right.png" alt="" />
          						<span>Getting Started with QUnit</span>
          					</div>
          					
          					<div   id="377j5v51b"   class="Articlelist_txts">
          						<div   id="377j5v51b"   class="Articlelist_txts_info">
          							<h1 class="Articlelist_txts_title">Getting Started with QUnit</h1>
          							<div   id="377j5v51b"   class="Articlelist_txts_info_head">
          								<div   id="377j5v51b"   class="author_info">
          									<a href="http://www.miracleart.cn/member/1468494.html"  class="author_avatar">
          									<img class="lazy"  data-src="https://img.php.cn/upload/avatar/000/000/001/66ea812815a39919.png" src="/static/imghw/default1.png" alt="Jennifer Aniston">
          									</a>
          									<div   id="377j5v51b"   class="author_detail">
          																			<a href="http://www.miracleart.cn/member/1468494.html" class="author_name">Jennifer Aniston</a>
                                          										</div>
          								</div>
                          			</div>
          							<span id="377j5v51b"    class="Articlelist_txts_time">Feb 21, 2025 pm	 12:12 PM</span>
          														
          						</div>
          					</div>
          					<hr />
          					<div   id="377j5v51b"   class="article_main php-article">
          						<div   id="377j5v51b"   class="article-list-left detail-content-wrap content">
          						<ins class="adsbygoogle"
          							style="display:block; text-align:center;"
          							data-ad-layout="in-article"
          							data-ad-format="fluid"
          							data-ad-client="ca-pub-5902227090019525"
          							data-ad-slot="3461856641">
          						</ins>
          						
          
          					<p><img src="/static/imghw/default1.png" data-src="https://img.php.cn/upload/article/000/000/000/174011113685793.jpg" class="lazy" alt="Getting Started with QUnit "></p>
          <p>Software testing is a process of evaluating software to detect the difference between the expected output and the actual output of a given input set. Testing, especially unit testing, should be an essential part of every developer's life. Unfortunately, many developers seem to be afraid of the activity. In JavaScript, we can choose from many frameworks to test our code base. For example, Mocha, Selenium, and QUnit. In this article, I will introduce you to QUnit. QUnit is a unit testing framework developed and maintained by the jQuery team, which is also behind projects such as jQuery and jQuery UI. </p>
          <p><strong>Key Points</strong></p>
          <ul>
          <li>QUnit is developed and maintained by the jQuery team and is a popular JavaScript unit testing framework for its ease of use and simplicity of setup. </li>
          <li>To get started with QUnit, download the latest version of JavaScript and CSS files from the QUnit website and include them in your HTML file. </li>
          <li>QUnit provides two ways to create new tests: <code>QUnit.test()</code> for synchronous code and <code>QUnit.asyncTest()</code> for asynchronous code. These tests contain assertions that verify that the code works as expected. </li>
          <li>QUnit provides a variety of assertion methods including <code>deepEqual()</code>, <code>equal()</code>, <code>notDeepEqual()</code>, <code>notEqual()</code>, <code>propEqual()</code>, <code>strictEqual()</code>, <code>notPropEqual()</code>, <code>notStrictEqual()</code>, <code>ok()</code>, <code>throws()</code>, </li>, <li>, <code>expect()</code> and </li> . Each method has its specific purpose and accepts certain parameters. </ul>
          <p>When creating tests with QUnit, the best practice is to set the number of assertions to be executed using the <strong> method. This helps ensure that all assertions are executed and if one or more assertions are not executed, the test will fail. </strong>
          </p>
          <p></p>Settings QUnit
          One of the main reasons many developers use QUnit is its ease of use. Getting started with this framework is very simple and you can master the main concepts in a few hours. The first step to using QUnit is obviously to start by downloading it. There are several ways to do this: manually download from the website, use CDN, use Bower, or use npm. My advice is that you should not rely on CDN to test your code unless you are developing a simple live demo. So stick to other options. For this article, I don't want to set any prerequisites (read Bower and npm), so we'll take the first approach. Therefore, visit the QUnit website and download the latest version of the JavaScript file (named qunit-1.14.0.js) and the CSS file (named qunit-1.14.0.css). Put them in a folder where you will also create an index.html. In this file, we will place the HTML code displayed on the home page of the website, and I will repeat it below for convenience. <pre class='brush:php;toolbar:false;'><!DOCTYPE html>
          <html>
          <head>
            <meta charset="utf-8">
            <title>QUnit Example</title>
            <link rel="stylesheet" href="qunit-1.14.0.css">
          </head>
          <body>
            <div id="qunit"></div>
            <div id="qunit-fixture"></div>
            <??>
            <??>
          </body>
          </html></pre>
          <p>As you can see, this code uses CDN to include CSS and JavaScript files. Therefore, you have to update the link to include the files you downloaded earlier. In the mark, you can see some <code><div></code> placed. The first one has qunit as its ID, used by the framework to display its user interface, where the test results are displayed. The second <code><div></code>, whose ID is qunit-fixture, should be used by you (the developer). This element allows developers to test code that adds, edits, or removes elements from the DOM without worrying about cleaning up the DOM after each test. If you put the element you created by your code in this <code><div></code>, QUnit will handle the reset for us. Finally, we include a tests.js file that represents the file containing the tests. My advice is to use files to store tests when working with real projects. In the live demo I created for this tutorial, I used JSBin and certainly did not allow uploading of files. So in the demo, you'll see that I've inlined the test code. Now that you understand what it means to tag each section, open the index.html page in your browser to see what happens. If all goes well, you should see a live demo interface as shown below, which is also provided as JSBin: QUnit example. At this stage, the only part of this interface that is relevant to us is the part that shows the time QUnit spends processing tests, the number of assertions defined, and the number of tests passed and failed. The above demonstration shows that we do not define any tests. Let's solve this problem. </p>
          <p><strong>How to create tests using QUnit</strong></p>
          <p>QUnit provides two ways to create new tests: <code>QUnit.test()</code> and <code>QUnit.asyncTest()</code>. The first one is used to test code running synchronously, while the second one is used to test asynchronous code. In this section, I will describe how to create tests for synchronous code. The signature of the <code>QUnit.test()</code> method is as follows: </p>
          <pre class='brush:php;toolbar:false;'>QUnit.test(name, testFunction)</pre>
          <p>The first parameter <code>name</code> is a string that helps us identify the created tests. The second parameter <code>testFunction</code> is a function that contains the assertions the framework will execute. The framework passes a parameter to this function that exposes all QUnit's assertion methods. Convert this description to code, we can update the tests.js file with the following code: </p>
          <pre class='brush:php;toolbar:false;'>QUnit.test('我的第一個測試', function(assert) {
             // 斷言在這里...
          });</pre>
          <p>This code creates a new test identified by the string "My First Test" and a function with an empty body. Adding tests without any assertions is of no use. To solve this problem, we must learn the assertion methods available in QUnit. </p>
          <p><strong>QUnit's assertion method</strong></p>
          <p>Assertions are at the heart of software testing. They allow us to verify that our code works as expected. In QUnit, we have many ways to verify these expectations. They can be accessed in tests by parameters of functions passed to the <code>QUnit.test()</code> method (in our previous example, <code>assert</code>). The following list summarizes the available methods, as well as their functions and signatures: </p><ul>
          <li><code>deepEqual(value, expected[, message])</code>: A recursive strict comparison that works for all JavaScript types. If <code>value</code> and <code>expected</code> are the same in terms of properties and values, and have the same prototype, the assertion is passed; </li>
          <li><code>equal(value, expected[, message])</code>: The <code>value</code> equals <code>expected</code> parameter provided using non-strict comparison (==) verification. </li>
          <li><code>notDeepEqual(value, expected[, message])</code>: Same as <code>deepEqual()</code>, but tests inequality; </li>
          <li><code>notEqual(value, expected[, message])</code>: Same as <code>equal()</code>, but tests inequality; </li>
          <li><code>propEqual(value, expected[, message])</code>: Strict comparison of the properties and values ??of an object. If all attributes and values ??are the same, the assertion passes; </li>
          <li><code>strictEqual(value, expected[, message])</code>: Use strict comparison (===) verification to provide the <code>value</code> parameter equal to the <code>expected</code>; </li>
          <li><code>notPropEqual(value, expected[, message])</code>: Same as <code>propEqual()</code>, but tests inequality; </li>
          <li><code>notStrictEqual(value, expected[, message])</code>: Same as <code>strictEqual()</code>, but tests inequality; </li>
          <li><code>ok(value[, message])</code>: If the first parameter is a true value, the assertion passes; </li>
          <li><code>throws(function[, expected][, message])</code>: Test whether the callback throws an exception and optionally compare the thrown errors; </li>
          </ul>
          <p>The parameters accepted by these methods are as follows: </p>
          <ul>
          <li><code>value</code>: The value returned by a function, method, or the value stored in a variable that must be verified; </li>
          <li><code>expected</code>: The value to be tested. For the <code>throws()</code> method, this can be <code><q cite="http://api.qunitjs.com/throws/">Error 對象(實例)、Error 函數(shù)(構(gòu)造函數(shù))、與字符串表示匹配(或部分匹配)的正則表達(dá)式或必須返回 true 以通過斷言檢查的回調(diào)函數(shù)</q></code>; </li>
          <li><code>message</code>: an optional string describing the assertion; </li>
          <li><code>function</code>: The function to be executed should return an Error; </li>
          </ul>
          <p>Now that you have understood the methods and parameters available, it's time to check out some code. Instead of writing multiple tests for a single function, I try to reproduce a more realistic example. Anyway, the tests I will show you should not be considered a complete test suite, but they should give you a specific idea of ??where to start. In order to write the mentioned tests, we need to define some code to test. In this case, I will define an object literal like this: </p><pre class='brush:php;toolbar:false;'><!DOCTYPE html>
          <html>
          <head>
            <meta charset="utf-8">
            <title>QUnit Example</title>
            <link rel="stylesheet" href="qunit-1.14.0.css">
          </head>
          <body>
            <div id="qunit"></div>
            <div id="qunit-fixture"></div>
            <??>
            <??>
          </body>
          </html></pre>
          <p> As you can see, we define an object literal with three functions: <code>max()</code>, <code>isOdd()</code>, and <code>sortObj()</code>. The first one accepts any number of parameters and returns the maximum value. <code>isOdd()</code> Take a number as its parameter and test if it is an odd number. <code>sortObj()</code> Accepts an array of objects, ideally there should be an attribute named timestamp and sorts them according to the value of this attribute. The possible test sets of these functions are as follows: (The lengthy test code example is omitted here because the word limit has been exceeded, but the principle is consistent with the previous description) </p>
          <p><strong>Set expectations</strong></p>
          <p> When creating a test, the best practice is to set the number of assertions we expect to execute. Doing so, if one or more assertions are not executed, the test will fail. The QUnit framework provides a <code>expect()</code> method for this purpose. This method is especially useful when dealing with asynchronous code, but it is best to use it when testing synchronous functions. The signature of the <code>expect()</code> method is as follows: </p>
          <pre class='brush:php;toolbar:false;'>QUnit.test(name, testFunction)</pre>
          The <p>where the <code>assertionsNumber</code> parameter specifies the expected number of assertions. (The example of updating the test code is also omitted here because the word limit has been exceeded, but the principle is consistent with the previous description) </p>
          <p><strong>QUnit Introduction Conclusion</strong></p>
          <p>In this tutorial, I introduce you to the magical world of testing, especially how to unit test JavaScript code using QUnit. We've seen how easy it is to set up the QUnit framework and what methods it provides to test synchronization functions. In addition, you have also learned the set of assertion functions provided by the framework for testing the code. Finally, I mentioned the importance of setting the number of assertions we expect to run and how to set them using the <code>expect()</code> method. I hope you enjoyed this post and you will consider integrating QUnit into your project. (The FAQs part is omitted here because the word limit has been exceeded) </p><p>The above is the detailed content of Getting Started with QUnit. For more information, please follow other related articles on the PHP Chinese website!</p>
          
          
          						</div>
          					</div>
          					<div   id="377j5v51b"   class="wzconShengming_sp">
          						<div   id="377j5v51b"   class="bzsmdiv_sp">Statement of this Website</div>
          						<div>The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn</div>
          					</div>
          				</div>
          
          				<ins class="adsbygoogle"
               style="display:block"
               data-ad-format="autorelaxed"
               data-ad-client="ca-pub-5902227090019525"
               data-ad-slot="2507867629"></ins>
          
          
          
          				<div   id="377j5v51b"   class="AI_ToolDetails_main4sR">
          
          
          				<ins class="adsbygoogle"
                  style="display:block"
                  data-ad-client="ca-pub-5902227090019525"
                  data-ad-slot="3653428331"
                  data-ad-format="auto"
                  data-full-width-responsive="true"></ins>
              
          
          
          					<!-- <div   id="377j5v51b"   class="phpgenera_Details_mainR4">
          						<div   id="377j5v51b"   class="phpmain1_4R_readrank">
          							<div   id="377j5v51b"   class="phpmain1_4R_readrank_top">
          								<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          									onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          									src="/static/imghw/hotarticle2.png" alt="" />
          								<h2>Hot Article</h2>
          							</div>
          							<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottom">
          															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
          									<a href="http://www.miracleart.cn/faq/1796828723.html" title="Agnes Tachyon Build Guide | A Pretty Derby Musume" class="phpgenera_Details_mainR4_bottom_title">Agnes Tachyon Build Guide | A Pretty Derby Musume</a>
          									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
          										<span>2 weeks ago</span>
          										<span>By Jack chen</span>
          									</div>
          								</div>
          															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
          									<a href="http://www.miracleart.cn/faq/1796827210.html" title="Oguri Cap Build Guide | A Pretty Derby Musume" class="phpgenera_Details_mainR4_bottom_title">Oguri Cap Build Guide | A Pretty Derby Musume</a>
          									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
          										<span>2 weeks ago</span>
          										<span>By Jack chen</span>
          									</div>
          								</div>
          															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
          									<a href="http://www.miracleart.cn/faq/1796821436.html" title="Dune: Awakening - Advanced Planetologist Quest Walkthrough" class="phpgenera_Details_mainR4_bottom_title">Dune: Awakening - Advanced Planetologist Quest Walkthrough</a>
          									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
          										<span>4 weeks ago</span>
          										<span>By Jack chen</span>
          									</div>
          								</div>
          															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
          									<a href="http://www.miracleart.cn/faq/1796821278.html" title="Date Everything: Dirk And Harper Relationship Guide" class="phpgenera_Details_mainR4_bottom_title">Date Everything: Dirk And Harper Relationship Guide</a>
          									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
          										<span>1 months ago</span>
          										<span>By Jack chen</span>
          									</div>
          								</div>
          															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
          									<a href="http://www.miracleart.cn/faq/1796821868.html" title="Palia: Rasquellywag's Riches Quest Walkthrough" class="phpgenera_Details_mainR4_bottom_title">Palia: Rasquellywag's Riches Quest Walkthrough</a>
          									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
          										<span>4 weeks ago</span>
          										<span>By DDD</span>
          									</div>
          								</div>
          														</div>
          							<div   id="377j5v51b"   class="phpgenera_Details_mainR3_more">
          								<a href="http://www.miracleart.cn/article.html">Show More</a>
          							</div>
          						</div>
          					</div> -->
          
          
          											<div   id="377j5v51b"   class="phpgenera_Details_mainR3">
          							<div   id="377j5v51b"   class="phpmain1_4R_readrank">
          								<div   id="377j5v51b"   class="phpmain1_4R_readrank_top">
          									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          										onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          										src="/static/imghw/hottools2.png" alt="" />
          									<h2>Hot AI Tools</h2>
          								</div>
          								<div   id="377j5v51b"   class="phpgenera_Details_mainR3_bottom">
          																		<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
          											<a href="http://www.miracleart.cn/ai/undress-ai-tool" title="Undress AI Tool" class="phpmain_tab2_mids_top_img">
          												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													class="lazy"  data-src="https://img.php.cn/upload/ai_manual/001/246/273/173410641626608.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Undress AI Tool" />
          											</a>
          											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
          												<a href="http://www.miracleart.cn/ai/undress-ai-tool" title="Undress AI Tool" class="phpmain_tab2_mids_title">
          													<h3>Undress AI Tool</h3>
          												</a>
          												<p>Undress images for free</p>
          											</div>
          										</div>
          																		<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
          											<a href="http://www.miracleart.cn/ai/undresserai-undress" title="Undresser.AI Undress" class="phpmain_tab2_mids_top_img">
          												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													class="lazy"  data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411540686492.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Undresser.AI Undress" />
          											</a>
          											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
          												<a href="http://www.miracleart.cn/ai/undresserai-undress" title="Undresser.AI Undress" class="phpmain_tab2_mids_title">
          													<h3>Undresser.AI Undress</h3>
          												</a>
          												<p>AI-powered app for creating realistic nude photos</p>
          											</div>
          										</div>
          																		<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
          											<a href="http://www.miracleart.cn/ai/ai-clothes-remover" title="AI Clothes Remover" class="phpmain_tab2_mids_top_img">
          												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													class="lazy"  data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411552797167.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="AI Clothes Remover" />
          											</a>
          											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
          												<a href="http://www.miracleart.cn/ai/ai-clothes-remover" title="AI Clothes Remover" class="phpmain_tab2_mids_title">
          													<h3>AI Clothes Remover</h3>
          												</a>
          												<p>Online AI tool for removing clothes from photos.</p>
          											</div>
          										</div>
          																		<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
          											<a href="http://www.miracleart.cn/ai/clothoffio" title="Clothoff.io" class="phpmain_tab2_mids_top_img">
          												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													class="lazy"  data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411529149311.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Clothoff.io" />
          											</a>
          											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
          												<a href="http://www.miracleart.cn/ai/clothoffio" title="Clothoff.io" class="phpmain_tab2_mids_title">
          													<h3>Clothoff.io</h3>
          												</a>
          												<p>AI clothes remover</p>
          											</div>
          										</div>
          																		<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
          											<a href="http://www.miracleart.cn/ai/video-swap" title="Video Face Swap" class="phpmain_tab2_mids_top_img">
          												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													class="lazy"  data-src="https://img.php.cn/upload/ai_manual/001/246/273/173414504068133.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Video Face Swap" />
          											</a>
          											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
          												<a href="http://www.miracleart.cn/ai/video-swap" title="Video Face Swap" class="phpmain_tab2_mids_title">
          													<h3>Video Face Swap</h3>
          												</a>
          												<p>Swap faces in any video effortlessly with our completely free AI face swap tool!</p>
          											</div>
          										</div>
          																</div>
          								<div   id="377j5v51b"   class="phpgenera_Details_mainR3_more">
          									<a href="http://www.miracleart.cn/ai">Show More</a>
          								</div>
          							</div>
          						</div>
          					
          
          
          					<div   id="377j5v51b"   class="phpgenera_Details_mainR4">
          						<div   id="377j5v51b"   class="phpmain1_4R_readrank">
          							<div   id="377j5v51b"   class="phpmain1_4R_readrank_top">
          								<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          									onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          									src="/static/imghw/hotarticle2.png" alt="" />
          								<h2>Hot Article</h2>
          							</div>
          							<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottom">
          															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
          									<a href="http://www.miracleart.cn/faq/1796828723.html" title="Agnes Tachyon Build Guide | A Pretty Derby Musume" class="phpgenera_Details_mainR4_bottom_title">Agnes Tachyon Build Guide | A Pretty Derby Musume</a>
          									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
          										<span>2 weeks ago</span>
          										<span>By Jack chen</span>
          									</div>
          								</div>
          															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
          									<a href="http://www.miracleart.cn/faq/1796827210.html" title="Oguri Cap Build Guide | A Pretty Derby Musume" class="phpgenera_Details_mainR4_bottom_title">Oguri Cap Build Guide | A Pretty Derby Musume</a>
          									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
          										<span>2 weeks ago</span>
          										<span>By Jack chen</span>
          									</div>
          								</div>
          															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
          									<a href="http://www.miracleart.cn/faq/1796821436.html" title="Dune: Awakening - Advanced Planetologist Quest Walkthrough" class="phpgenera_Details_mainR4_bottom_title">Dune: Awakening - Advanced Planetologist Quest Walkthrough</a>
          									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
          										<span>4 weeks ago</span>
          										<span>By Jack chen</span>
          									</div>
          								</div>
          															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
          									<a href="http://www.miracleart.cn/faq/1796821278.html" title="Date Everything: Dirk And Harper Relationship Guide" class="phpgenera_Details_mainR4_bottom_title">Date Everything: Dirk And Harper Relationship Guide</a>
          									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
          										<span>1 months ago</span>
          										<span>By Jack chen</span>
          									</div>
          								</div>
          															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
          									<a href="http://www.miracleart.cn/faq/1796821868.html" title="Palia: Rasquellywag's Riches Quest Walkthrough" class="phpgenera_Details_mainR4_bottom_title">Palia: Rasquellywag's Riches Quest Walkthrough</a>
          									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
          										<span>4 weeks ago</span>
          										<span>By DDD</span>
          									</div>
          								</div>
          														</div>
          							<div   id="377j5v51b"   class="phpgenera_Details_mainR3_more">
          								<a href="http://www.miracleart.cn/article.html">Show More</a>
          							</div>
          						</div>
          					</div>
          
          
          											<div   id="377j5v51b"   class="phpgenera_Details_mainR3">
          							<div   id="377j5v51b"   class="phpmain1_4R_readrank">
          								<div   id="377j5v51b"   class="phpmain1_4R_readrank_top">
          									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          										onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          										src="/static/imghw/hottools2.png" alt="" />
          									<h2>Hot Tools</h2>
          								</div>
          								<div   id="377j5v51b"   class="phpgenera_Details_mainR3_bottom">
          																		<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
          											<a href="http://www.miracleart.cn/toolset/development-tools/92" title="Notepad++7.3.1" class="phpmain_tab2_mids_top_img">
          												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													class="lazy"  data-src="https://img.php.cn/upload/manual/000/000/001/58ab96f0f39f7357.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="Notepad++7.3.1" />
          											</a>
          											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
          												<a href="http://www.miracleart.cn/toolset/development-tools/92" title="Notepad++7.3.1" class="phpmain_tab2_mids_title">
          													<h3>Notepad++7.3.1</h3>
          												</a>
          												<p>Easy-to-use and free code editor</p>
          											</div>
          										</div>
          																			<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
          											<a href="http://www.miracleart.cn/toolset/development-tools/93" title="SublimeText3 Chinese version" class="phpmain_tab2_mids_top_img">
          												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													class="lazy"  data-src="https://img.php.cn/upload/manual/000/000/001/58ab97a3baad9677.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="SublimeText3 Chinese version" />
          											</a>
          											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
          												<a href="http://www.miracleart.cn/toolset/development-tools/93" title="SublimeText3 Chinese version" class="phpmain_tab2_mids_title">
          													<h3>SublimeText3 Chinese version</h3>
          												</a>
          												<p>Chinese version, very easy to use</p>
          											</div>
          										</div>
          																			<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
          											<a href="http://www.miracleart.cn/toolset/development-tools/121" title="Zend Studio 13.0.1" class="phpmain_tab2_mids_top_img">
          												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													class="lazy"  data-src="https://img.php.cn/upload/manual/000/000/001/58ab97ecd1ab2670.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="Zend Studio 13.0.1" />
          											</a>
          											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
          												<a href="http://www.miracleart.cn/toolset/development-tools/121" title="Zend Studio 13.0.1" class="phpmain_tab2_mids_title">
          													<h3>Zend Studio 13.0.1</h3>
          												</a>
          												<p>Powerful PHP integrated development environment</p>
          											</div>
          										</div>
          																			<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
          											<a href="http://www.miracleart.cn/toolset/development-tools/469" title="Dreamweaver CS6" class="phpmain_tab2_mids_top_img">
          												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													class="lazy"  data-src="https://img.php.cn/upload/manual/000/000/001/58d0e0fc74683535.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="Dreamweaver CS6" />
          											</a>
          											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
          												<a href="http://www.miracleart.cn/toolset/development-tools/469" title="Dreamweaver CS6" class="phpmain_tab2_mids_title">
          													<h3>Dreamweaver CS6</h3>
          												</a>
          												<p>Visual web development tools</p>
          											</div>
          										</div>
          																			<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
          											<a href="http://www.miracleart.cn/toolset/development-tools/500" title="SublimeText3 Mac version" class="phpmain_tab2_mids_top_img">
          												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          													class="lazy"  data-src="https://img.php.cn/upload/manual/000/000/001/58d34035e2757995.png?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="SublimeText3 Mac version" />
          											</a>
          											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
          												<a href="http://www.miracleart.cn/toolset/development-tools/500" title="SublimeText3 Mac version" class="phpmain_tab2_mids_title">
          													<h3>SublimeText3 Mac version</h3>
          												</a>
          												<p>God-level code editing software (SublimeText3)</p>
          											</div>
          										</div>
          																	</div>
          								<div   id="377j5v51b"   class="phpgenera_Details_mainR3_more">
          									<a href="http://www.miracleart.cn/ai">Show More</a>
          								</div>
          							</div>
          						</div>
          										
          
          					
          					<div   id="377j5v51b"   class="phpgenera_Details_mainR4">
          						<div   id="377j5v51b"   class="phpmain1_4R_readrank">
          							<div   id="377j5v51b"   class="phpmain1_4R_readrank_top">
          								<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          									onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          									src="/static/imghw/hotarticle2.png" alt="" />
          								<h2>Hot Topics</h2>
          							</div>
          							<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottom">
          															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
          									<a href="http://www.miracleart.cn/faq/gmailyxdlrkzn" title="Where is the login entrance for gmail email?" class="phpgenera_Details_mainR4_bottom_title">Where is the login entrance for gmail email?</a>
          									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
          										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
          											<img src="/static/imghw/eyess.png" alt="" />
          											<span>8639</span>
          										</div>
          										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
          											<img src="/static/imghw/tiezi.png" alt="" />
          											<span>17</span>
          										</div>
          									</div>
          								</div>
          															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
          									<a href="http://www.miracleart.cn/faq/java-tutorial" title="Java Tutorial" class="phpgenera_Details_mainR4_bottom_title">Java Tutorial</a>
          									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
          										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
          											<img src="/static/imghw/eyess.png" alt="" />
          											<span>1786</span>
          										</div>
          										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
          											<img src="/static/imghw/tiezi.png" alt="" />
          											<span>16</span>
          										</div>
          									</div>
          								</div>
          															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
          									<a href="http://www.miracleart.cn/faq/cakephp-tutor" title="CakePHP Tutorial" class="phpgenera_Details_mainR4_bottom_title">CakePHP Tutorial</a>
          									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
          										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
          											<img src="/static/imghw/eyess.png" alt="" />
          											<span>1729</span>
          										</div>
          										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
          											<img src="/static/imghw/tiezi.png" alt="" />
          											<span>56</span>
          										</div>
          									</div>
          								</div>
          															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
          									<a href="http://www.miracleart.cn/faq/laravel-tutori" title="Laravel Tutorial" class="phpgenera_Details_mainR4_bottom_title">Laravel Tutorial</a>
          									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
          										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
          											<img src="/static/imghw/eyess.png" alt="" />
          											<span>1581</span>
          										</div>
          										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
          											<img src="/static/imghw/tiezi.png" alt="" />
          											<span>29</span>
          										</div>
          									</div>
          								</div>
          															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
          									<a href="http://www.miracleart.cn/faq/php-tutorial" title="PHP Tutorial" class="phpgenera_Details_mainR4_bottom_title">PHP Tutorial</a>
          									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
          										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
          											<img src="/static/imghw/eyess.png" alt="" />
          											<span>1448</span>
          										</div>
          										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
          											<img src="/static/imghw/tiezi.png" alt="" />
          											<span>31</span>
          										</div>
          									</div>
          								</div>
          														</div>
          							<div   id="377j5v51b"   class="phpgenera_Details_mainR3_more">
          								<a href="http://www.miracleart.cn/faq/zt">Show More</a>
          							</div>
          						</div>
          					</div>
          				</div>
          			</div>
          							<div   id="377j5v51b"   class="Article_Details_main2">
          					<div   id="377j5v51b"   class="phpgenera_Details_mainL4">
          						<div   id="377j5v51b"   class="phpmain1_2_top">
          							<a href="javascript:void(0);" class="phpmain1_2_top_title">Related knowledge<img
          									src="/static/imghw/index2_title2.png" alt="" /></a>
          						</div>
          						<div   id="377j5v51b"   class="phpgenera_Details_mainL4_info">
          
          													<div   id="377j5v51b"   class="phphistorical_Version2_mids">
          								<a href="http://www.miracleart.cn/faq/1796822063.html" title="Java vs. JavaScript: Clearing Up the Confusion" class="phphistorical_Version2_mids_img">
          									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/253/068/175035046165294.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="Java vs. JavaScript: Clearing Up the Confusion" />
          								</a>
          								<a href="http://www.miracleart.cn/faq/1796822063.html" title="Java vs. JavaScript: Clearing Up the Confusion" class="phphistorical_Version2_mids_title">Java vs. JavaScript: Clearing Up the Confusion</a>
          								<span id="377j5v51b"    class="Articlelist_txts_time">Jun 20, 2025 am	 12:27 AM</span>
          								<p class="Articlelist_txts_p">Java and JavaScript are different programming languages, each suitable for different application scenarios. Java is used for large enterprise and mobile application development, while JavaScript is mainly used for web page development.</p>
          							</div>
          														<div   id="377j5v51b"   class="phphistorical_Version2_mids">
          								<a href="http://www.miracleart.cn/faq/1796821632.html" title="Javascript Comments: short explanation" class="phphistorical_Version2_mids_img">
          									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/253/068/175026483186295.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="Javascript Comments: short explanation" />
          								</a>
          								<a href="http://www.miracleart.cn/faq/1796821632.html" title="Javascript Comments: short explanation" class="phphistorical_Version2_mids_title">Javascript Comments: short explanation</a>
          								<span id="377j5v51b"    class="Articlelist_txts_time">Jun 19, 2025 am	 12:40 AM</span>
          								<p class="Articlelist_txts_p">JavaScriptcommentsareessentialformaintaining,reading,andguidingcodeexecution.1)Single-linecommentsareusedforquickexplanations.2)Multi-linecommentsexplaincomplexlogicorprovidedetaileddocumentation.3)Inlinecommentsclarifyspecificpartsofcode.Bestpractic</p>
          							</div>
          														<div   id="377j5v51b"   class="phphistorical_Version2_mids">
          								<a href="http://www.miracleart.cn/faq/1796827639.html" title="How to work with dates and times in js?" class="phphistorical_Version2_mids_img">
          									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/431/639/175130445135407.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="How to work with dates and times in js?" />
          								</a>
          								<a href="http://www.miracleart.cn/faq/1796827639.html" title="How to work with dates and times in js?" class="phphistorical_Version2_mids_title">How to work with dates and times in js?</a>
          								<span id="377j5v51b"    class="Articlelist_txts_time">Jul 01, 2025 am	 01:27 AM</span>
          								<p class="Articlelist_txts_p">The following points should be noted when processing dates and time in JavaScript: 1. There are many ways to create Date objects. It is recommended to use ISO format strings to ensure compatibility; 2. Get and set time information can be obtained and set methods, and note that the month starts from 0; 3. Manually formatting dates requires strings, and third-party libraries can also be used; 4. It is recommended to use libraries that support time zones, such as Luxon. Mastering these key points can effectively avoid common mistakes.</p>
          							</div>
          														<div   id="377j5v51b"   class="phphistorical_Version2_mids">
          								<a href="http://www.miracleart.cn/faq/1796828200.html" title="Why should you place  tags at the bottom of the ?" class="phphistorical_Version2_mids_img">
          									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/253/068/175139053194540.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="Why should you place  tags at the bottom of the ?" />
          								</a>
          								<a href="http://www.miracleart.cn/faq/1796828200.html" title="Why should you place  tags at the bottom of the ?" class="phphistorical_Version2_mids_title">Why should you place  tags at the bottom of the ?</a>
          								<span id="377j5v51b"    class="Articlelist_txts_time">Jul 02, 2025 am	 01:22 AM</span>
          								<p class="Articlelist_txts_p">PlacingtagsatthebottomofablogpostorwebpageservespracticalpurposesforSEO,userexperience,anddesign.1.IthelpswithSEObyallowingsearchenginestoaccesskeyword-relevanttagswithoutclutteringthemaincontent.2.Itimprovesuserexperiencebykeepingthefocusonthearticl</p>
          							</div>
          														<div   id="377j5v51b"   class="phphistorical_Version2_mids">
          								<a href="http://www.miracleart.cn/faq/1796822037.html" title="JavaScript vs. Java: A Comprehensive Comparison for Developers" class="phphistorical_Version2_mids_img">
          									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/253/068/175035006093854.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="JavaScript vs. Java: A Comprehensive Comparison for Developers" />
          								</a>
          								<a href="http://www.miracleart.cn/faq/1796822037.html" title="JavaScript vs. Java: A Comprehensive Comparison for Developers" class="phphistorical_Version2_mids_title">JavaScript vs. Java: A Comprehensive Comparison for Developers</a>
          								<span id="377j5v51b"    class="Articlelist_txts_time">Jun 20, 2025 am	 12:21 AM</span>
          								<p class="Articlelist_txts_p">JavaScriptispreferredforwebdevelopment,whileJavaisbetterforlarge-scalebackendsystemsandAndroidapps.1)JavaScriptexcelsincreatinginteractivewebexperienceswithitsdynamicnatureandDOMmanipulation.2)Javaoffersstrongtypingandobject-orientedfeatures,idealfor</p>
          							</div>
          														<div   id="377j5v51b"   class="phphistorical_Version2_mids">
          								<a href="http://www.miracleart.cn/faq/1796828191.html" title="What is event bubbling and capturing in the DOM?" class="phphistorical_Version2_mids_img">
          									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/253/068/175139034116786.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="What is event bubbling and capturing in the DOM?" />
          								</a>
          								<a href="http://www.miracleart.cn/faq/1796828191.html" title="What is event bubbling and capturing in the DOM?" class="phphistorical_Version2_mids_title">What is event bubbling and capturing in the DOM?</a>
          								<span id="377j5v51b"    class="Articlelist_txts_time">Jul 02, 2025 am	 01:19 AM</span>
          								<p class="Articlelist_txts_p">Event capture and bubble are two stages of event propagation in DOM. Capture is from the top layer to the target element, and bubble is from the target element to the top layer. 1. Event capture is implemented by setting the useCapture parameter of addEventListener to true; 2. Event bubble is the default behavior, useCapture is set to false or omitted; 3. Event propagation can be used to prevent event propagation; 4. Event bubbling supports event delegation to improve dynamic content processing efficiency; 5. Capture can be used to intercept events in advance, such as logging or error processing. Understanding these two phases helps to accurately control the timing and how JavaScript responds to user operations.</p>
          							</div>
          														<div   id="377j5v51b"   class="phphistorical_Version2_mids">
          								<a href="http://www.miracleart.cn/faq/1796822137.html" title="JavaScript: Exploring Data Types for Efficient Coding" class="phphistorical_Version2_mids_img">
          									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/253/068/175035157160537.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="JavaScript: Exploring Data Types for Efficient Coding" />
          								</a>
          								<a href="http://www.miracleart.cn/faq/1796822137.html" title="JavaScript: Exploring Data Types for Efficient Coding" class="phphistorical_Version2_mids_title">JavaScript: Exploring Data Types for Efficient Coding</a>
          								<span id="377j5v51b"    class="Articlelist_txts_time">Jun 20, 2025 am	 12:46 AM</span>
          								<p class="Articlelist_txts_p">JavaScripthassevenfundamentaldatatypes:number,string,boolean,undefined,null,object,andsymbol.1)Numbersuseadouble-precisionformat,usefulforwidevaluerangesbutbecautiouswithfloating-pointarithmetic.2)Stringsareimmutable,useefficientconcatenationmethodsf</p>
          							</div>
          														<div   id="377j5v51b"   class="phphistorical_Version2_mids">
          								<a href="http://www.miracleart.cn/faq/1796824597.html" title="How can you reduce the payload size of a JavaScript application?" class="phphistorical_Version2_mids_img">
          									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
          										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/253/068/175087047055234.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="How can you reduce the payload size of a JavaScript application?" />
          								</a>
          								<a href="http://www.miracleart.cn/faq/1796824597.html" title="How can you reduce the payload size of a JavaScript application?" class="phphistorical_Version2_mids_title">How can you reduce the payload size of a JavaScript application?</a>
          								<span id="377j5v51b"    class="Articlelist_txts_time">Jun 26, 2025 am	 12:54 AM</span>
          								<p class="Articlelist_txts_p">If JavaScript applications load slowly and have poor performance, the problem is that the payload is too large. Solutions include: 1. Use code splitting (CodeSplitting), split the large bundle into multiple small files through React.lazy() or build tools, and load it as needed to reduce the first download; 2. Remove unused code (TreeShaking), use the ES6 module mechanism to clear "dead code" to ensure that the introduced libraries support this feature; 3. Compress and merge resource files, enable Gzip/Brotli and Terser to compress JS, reasonably merge files and optimize static resources; 4. Replace heavy-duty dependencies and choose lightweight libraries such as day.js and fetch</p>
          							</div>
          													</div>
          
          													<a href="http://www.miracleart.cn/web-designer.html" class="phpgenera_Details_mainL4_botton">
          								<span>See all articles</span>
          								<img src="/static/imghw/down_right.png" alt="" />
          							</a>
          											</div>
          				</div>
          					</div>
          	</main>
          	<footer>
              <div   id="377j5v51b"   class="footer">
                  <div   id="377j5v51b"   class="footertop">
                      <img src="/static/imghw/logo.png" alt="">
                      <p>Public welfare online PHP training,Help PHP learners grow quickly!</p>
                  </div>
                  <div   id="377j5v51b"   class="footermid">
                      <a href="http://www.miracleart.cn/about/us.html">About us</a>
                      <a href="http://www.miracleart.cn/about/disclaimer.html">Disclaimer</a>
                      <a href="http://www.miracleart.cn/update/article_0_1.html">Sitemap</a>
                  </div>
                  <div   id="377j5v51b"   class="footerbottom">
                      <p>
                          ? php.cn All rights reserved
                      </p>
                  </div>
              </div>
          </footer>
          
          <input type="hidden" id="verifycode" value="/captcha.html">
          
          
          
          
          		<link rel='stylesheet' id='_main-css' href='/static/css/viewer.min.css?2' type='text/css' media='all' />
          	
          	
          	
          	
          	
          
          	
          	
          
          
          
          
          
          
          <footer>
          <div class="friendship-link">
          <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p>
          <a href="http://www.miracleart.cn/" title="国产av日韩一区二区三区精品">国产av日韩一区二区三区精品</a>
          
          <div class="friend-links">
          
          
          </div>
          </div>
          
          </footer>
          
          
          <script>
          (function(){
              var bp = document.createElement('script');
              var curProtocol = window.location.protocol.split(':')[0];
              if (curProtocol === 'https') {
                  bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
              }
              else {
                  bp.src = 'http://push.zhanzhang.baidu.com/push.js';
              }
              var s = document.getElementsByTagName("script")[0];
              s.parentNode.insertBefore(bp, s);
          })();
          </script>
          </body><div id="90nkr" class="pl_css_ganrao" style="display: none;"><rt id="90nkr"></rt><wbr id="90nkr"></wbr><td id="90nkr"></td><center id="90nkr"><label id="90nkr"></label></center><menu id="90nkr"></menu><em id="90nkr"><s id="90nkr"><kbd id="90nkr"></kbd></s></em><ul id="90nkr"></ul><legend id="90nkr"><ruby id="90nkr"><tbody id="90nkr"></tbody></ruby></legend><th id="90nkr"></th><object id="90nkr"></object><dfn id="90nkr"><listing id="90nkr"><pre id="90nkr"></pre></listing></dfn><p id="90nkr"></p><wbr id="90nkr"><li id="90nkr"><dl id="90nkr"></dl></li></wbr><kbd id="90nkr"></kbd><nav id="90nkr"><samp id="90nkr"><i id="90nkr"></i></samp></nav><strong id="90nkr"><address id="90nkr"><nav id="90nkr"></nav></address></strong><pre id="90nkr"></pre><pre id="90nkr"></pre><xmp id="90nkr"><li id="90nkr"><xmp id="90nkr"></xmp></li></xmp><samp id="90nkr"></samp><rt id="90nkr"></rt><small id="90nkr"><tfoot id="90nkr"><dfn id="90nkr"></dfn></tfoot></small><style id="90nkr"></style><input id="90nkr"></input><dd id="90nkr"></dd><option id="90nkr"><acronym id="90nkr"><noframes id="90nkr"><rt id="90nkr"></rt></noframes></acronym></option><ul id="90nkr"><legend id="90nkr"><ul id="90nkr"><code id="90nkr"></code></ul></legend></ul><video id="90nkr"></video><abbr id="90nkr"><div id="90nkr"></div></abbr><big id="90nkr"></big><style id="90nkr"></style><optgroup id="90nkr"><td id="90nkr"><optgroup id="90nkr"></optgroup></td></optgroup><optgroup id="90nkr"><blockquote id="90nkr"><pre id="90nkr"></pre></blockquote></optgroup><b id="90nkr"></b><video id="90nkr"><strike id="90nkr"><abbr id="90nkr"><form id="90nkr"></form></abbr></strike></video><fieldset id="90nkr"><output id="90nkr"><fieldset id="90nkr"><option id="90nkr"></option></fieldset></output></fieldset><menu id="90nkr"></menu><fieldset id="90nkr"></fieldset><form id="90nkr"></form><font id="90nkr"><object id="90nkr"></object></font><style id="90nkr"></style><acronym id="90nkr"><noframes id="90nkr"><center id="90nkr"><optgroup id="90nkr"></optgroup></center></noframes></acronym><tr id="90nkr"><noframes id="90nkr"></noframes></tr><code id="90nkr"><menuitem id="90nkr"><code id="90nkr"><tr id="90nkr"></tr></code></menuitem></code><tfoot id="90nkr"><track id="90nkr"></track></tfoot><th id="90nkr"><tbody id="90nkr"></tbody></th><label id="90nkr"></label><sub id="90nkr"></sub><video id="90nkr"></video><abbr id="90nkr"><div id="90nkr"></div></abbr><nav id="90nkr"></nav><pre id="90nkr"><var id="90nkr"><form id="90nkr"><optgroup id="90nkr"></optgroup></form></var></pre><dd id="90nkr"><abbr id="90nkr"><menuitem id="90nkr"></menuitem></abbr></dd><sub id="90nkr"></sub><nav id="90nkr"><thead id="90nkr"><input id="90nkr"><del id="90nkr"></del></input></thead></nav><ins id="90nkr"><dfn id="90nkr"><pre id="90nkr"></pre></dfn></ins><var id="90nkr"><center id="90nkr"><object id="90nkr"></object></center></var><mark id="90nkr"></mark><div id="90nkr"></div><optgroup id="90nkr"></optgroup><th id="90nkr"></th><u id="90nkr"></u><li id="90nkr"><dl id="90nkr"><th id="90nkr"></th></dl></li><tr id="90nkr"></tr><p id="90nkr"></p><dd id="90nkr"><abbr id="90nkr"><tfoot id="90nkr"></tfoot></abbr></dd><strong id="90nkr"></strong><p id="90nkr"></p><i id="90nkr"></i><kbd id="90nkr"><th id="90nkr"><center id="90nkr"></center></th></kbd><strong id="90nkr"></strong><fieldset id="90nkr"></fieldset><kbd id="90nkr"><strong id="90nkr"><center id="90nkr"></center></strong></kbd><wbr id="90nkr"></wbr><dl id="90nkr"><sup id="90nkr"><strong id="90nkr"></strong></sup></dl><blockquote id="90nkr"><code id="90nkr"></code></blockquote><pre id="90nkr"></pre><fieldset id="90nkr"><center id="90nkr"><th id="90nkr"><center id="90nkr"></center></th></center></fieldset><table id="90nkr"><address id="90nkr"><nav id="90nkr"></nav></address></table><tbody id="90nkr"></tbody><th id="90nkr"><track id="90nkr"><tfoot id="90nkr"><noframes id="90nkr"></noframes></tfoot></track></th><button id="90nkr"><dl id="90nkr"><button id="90nkr"></button></dl></button><nav id="90nkr"><thead id="90nkr"><input id="90nkr"><del id="90nkr"></del></input></thead></nav><tr id="90nkr"><noframes id="90nkr"><span id="90nkr"></span></noframes></tr><strong id="90nkr"><sup id="90nkr"><table id="90nkr"></table></sup></strong><pre id="90nkr"></pre><tr id="90nkr"></tr><acronym id="90nkr"></acronym><sub id="90nkr"></sub><center id="90nkr"><label id="90nkr"><pre id="90nkr"></pre></label></center><em id="90nkr"></em><p id="90nkr"></p><samp id="90nkr"><strong id="90nkr"><output id="90nkr"></output></strong></samp><abbr id="90nkr"><dd id="90nkr"></dd></abbr><ul id="90nkr"><legend id="90nkr"><ul id="90nkr"><dl id="90nkr"></dl></ul></legend></ul><strong id="90nkr"></strong><legend id="90nkr"></legend><input id="90nkr"><em id="90nkr"></em></input><ul id="90nkr"></ul><ul id="90nkr"><strike id="90nkr"><tr id="90nkr"></tr></strike></ul><strike id="90nkr"><button id="90nkr"><source id="90nkr"></source></button></strike><tr id="90nkr"></tr><dfn id="90nkr"></dfn><kbd id="90nkr"></kbd><strong id="90nkr"><acronym id="90nkr"><u id="90nkr"><center id="90nkr"></center></u></acronym></strong><acronym id="90nkr"><sup id="90nkr"><thead id="90nkr"><input id="90nkr"></input></thead></sup></acronym><tr id="90nkr"><nobr id="90nkr"><tr id="90nkr"><nav id="90nkr"></nav></tr></nobr></tr><fieldset id="90nkr"><center id="90nkr"></center></fieldset><samp id="90nkr"></samp><tbody id="90nkr"><strike id="90nkr"><abbr id="90nkr"></abbr></strike></tbody><s id="90nkr"><b id="90nkr"></b></s><xmp id="90nkr"><label id="90nkr"></label></xmp><font id="90nkr"><menu id="90nkr"><small id="90nkr"></small></menu></font><p id="90nkr"></p><td id="90nkr"><form id="90nkr"></form></td><listing id="90nkr"><dfn id="90nkr"><optgroup id="90nkr"><sub id="90nkr"></sub></optgroup></dfn></listing><ul id="90nkr"></ul><pre id="90nkr"></pre><nav id="90nkr"></nav><code id="90nkr"><ins id="90nkr"><strike id="90nkr"></strike></ins></code><em id="90nkr"></em><meter id="90nkr"><bdo id="90nkr"></bdo></meter><address id="90nkr"><table id="90nkr"><xmp id="90nkr"><label id="90nkr"></label></xmp></table></address><rt id="90nkr"><small id="90nkr"></small></rt><option id="90nkr"></option><dl id="90nkr"><ruby id="90nkr"><tbody id="90nkr"></tbody></ruby></dl><listing id="90nkr"><dfn id="90nkr"><optgroup id="90nkr"><sub id="90nkr"></sub></optgroup></dfn></listing><label id="90nkr"><sub id="90nkr"><optgroup id="90nkr"></optgroup></sub></label><center id="90nkr"></center><td id="90nkr"></td><strong id="90nkr"><dfn id="90nkr"><listing id="90nkr"></listing></dfn></strong><tr id="90nkr"></tr><big id="90nkr"></big><ul id="90nkr"></ul><small id="90nkr"><tfoot id="90nkr"><dfn id="90nkr"></dfn></tfoot></small><nav id="90nkr"><samp id="90nkr"><tbody id="90nkr"></tbody></samp></nav><u id="90nkr"></u><listing id="90nkr"><pre id="90nkr"></pre></listing><acronym id="90nkr"></acronym><option id="90nkr"></option><mark id="90nkr"></mark><optgroup id="90nkr"><td id="90nkr"><optgroup id="90nkr"></optgroup></td></optgroup><span id="90nkr"></span><acronym id="90nkr"></acronym><menuitem id="90nkr"><code id="90nkr"><acronym id="90nkr"><sup id="90nkr"></sup></acronym></code></menuitem><li id="90nkr"><dl id="90nkr"><ruby id="90nkr"></ruby></dl></li><var id="90nkr"></var><s id="90nkr"></s><code id="90nkr"><menuitem id="90nkr"><code id="90nkr"><acronym id="90nkr"></acronym></code></menuitem></code></div>
          
          </html>