{"id":77299,"date":"2024-08-29T16:53:56","date_gmt":"2024-08-29T09:53:56","guid":{"rendered":"https:\/\/itviec.com\/blog\/?p=77299"},"modified":"2024-08-29T16:53:56","modified_gmt":"2024-08-29T09:53:56","slug":"array-javascript-la-gi","status":"publish","type":"post","link":"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/","title":{"rendered":"Array JavaScript: T\u1ed5ng h\u1ee3p 12 ph\u01b0\u01a1ng th\u1ee9c quan tr\u1ecdng c\u1ee7a array"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">N\u1ed9i dung b\u00e0i vi\u1ebft<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/#Dinh_nghia_ve_Array_Javascript\" >\u0110\u1ecbnh ngh\u0129a v\u1ec1 Array Javascript<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/#12_phuong_thuc_co_ban_cua_Array_Javascript\" >12 ph\u01b0\u01a1ng th\u1ee9c c\u01a1 b\u1ea3n c\u1ee7a Array Javascript\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/#Cach_khai_bao_Array_Javascript\" >C\u00e1ch khai b\u00e1o Array Javascript<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/#Thao_tac_co_ban_voi_Array_Javascript\" >Thao t\u00e1c c\u01a1 b\u1ea3n v\u1edbi Array Javascript<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/#Cau_hoi_thuong_gap_ve_Array_Javascript\" >C\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 Array Javascript<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/#Tong_ket_ve_Array_Javascript\" >T\u1ed5ng k\u1ebft v\u1ec1 Array Javascript<\/a><\/li><\/ul><\/nav><\/div>\n<p><b><i>Array Javascript l\u00e0 c\u1ea5u tr\u00fac d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 l\u01b0u tr\u1eef nhi\u1ec1u gi\u00e1 tr\u1ecb trong m\u1ed9t bi\u1ebfn duy nh\u1ea5t. Ch\u00fang c\u00f3 th\u1ec3 ch\u1ee9a nhi\u1ec1u ki\u1ec3u d\u1eef li\u1ec7u kh\u00e1c nhau v\u00e0 c\u00e1c ph\u1ea7n t\u1eed \u0111\u01b0\u1ee3c truy c\u1eadp theo ch\u1ec9 m\u1ee5c b\u1eaft \u0111\u1ea7u t\u1eeb 0.<\/i><\/b><\/p>\n<p><span style=\"font-weight: 400;\">\u0110\u1ecdc b\u00e0i vi\u1ebft sau \u0111\u00e2y \u0111\u1ec3 \u0111\u01b0\u1ee3c gi\u1ea3i \u0111\u00e1p chi ti\u1ebft h\u01a1n v\u1ec1:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">T\u1ed5ng quan v\u1ec1 Array Javascript<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">C\u00e1c ph\u01b0\u01a1ng ph\u00e1p c\u0169ng nh\u01b0 c\u00e1ch s\u1eed d\u1ee5ng Array Javascript trong khai b\u00e1o<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Thao t\u00e1c Array Javascript c\u01a1 b\u1ea3n<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Dinh_nghia_ve_Array_Javascript\"><\/span><b> \u0110\u1ecbnh ngh\u0129a v\u1ec1 Array Javascript<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">M\u1ea3ng (Array) l\u00e0 ki\u1ec3u d\u1eef li\u1ec7u trong <\/span><strong><a href=\"https:\/\/itviec.com\/blog\/javascript-la-gi\/\" target=\"_blank\" rel=\"noopener\">Javascript<\/a><\/strong><span style=\"font-weight: 400;\"> v\u00e0 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 l\u01b0u tr\u1eef nhi\u1ec1u gi\u00e1 tr\u1ecb trong m\u1ed9t bi\u1ebfn. C\u00e1c gi\u00e1 tr\u1ecb trong m\u1ea3ng c\u00f3 th\u1ec3 thu\u1ed9c b\u1ea5t k\u1ef3 ki\u1ec3u d\u1eef li\u1ec7u n\u00e0o, ch\u1eb3ng h\u1ea1n nh\u01b0 chu\u1ed7i, s\u1ed1, boolean, ho\u1eb7c c\u00e1c ki\u1ec3u d\u1eef li\u1ec7u kh\u00e1c.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-77353 aligncenter\" src=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-1-vippro.jpg\" alt=\"array javascript - itviec blog\" width=\"1000\" height=\"441\" srcset=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-1-vippro.jpg 1000w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-1-vippro-300x132.jpg 300w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-1-vippro-700x309.jpg 640w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-1-vippro-200x88.jpg 200w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-1-vippro-100x44.jpg 100w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p style=\"text-align: center;\"><i><span style=\"font-weight: 400;\">Array Javascript (Ngu\u1ed3n: Geeksforgeeks)<\/span><\/i><\/p>\n<p><span style=\"font-weight: 400;\">M\u1ed9t s\u1ed1 thu\u1eadt ng\u1eef c\u01a1 b\u1ea3n trong Array Javascript nh\u01b0:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>M\u1ea3ng (Array):<\/b><span style=\"font-weight: 400;\"> C\u1ea5u tr\u00fac d\u1eef li\u1ec7u trong Javascript cho ph\u00e9p b\u1ea1n l\u01b0u tr\u1eef nhi\u1ec1u gi\u00e1 tr\u1ecb trong m\u1ed9t bi\u1ebfn duy nh\u1ea5t.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Ph\u1ea7n t\u1eed m\u1ea3ng (Array Element):<\/b><span style=\"font-weight: 400;\"> M\u1ed7i gi\u00e1 tr\u1ecb trong m\u1ed9t m\u1ea3ng \u0111\u01b0\u1ee3c g\u1ecdi l\u00e0 m\u1ed9t ph\u1ea7n t\u1eed, c\u00e1c ph\u1ea7n t\u1eed \u0111\u01b0\u1ee3c truy c\u1eadp theo ch\u1ec9 m\u1ee5c c\u1ee7a ch\u00fang.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Ch\u1ec9 m\u1ee5c m\u1ea3ng (Array Index):<\/b><span style=\"font-weight: 400;\"> M\u1ed9t bi\u1ec3u di\u1ec5n s\u1ed1 cho bi\u1ebft v\u1ecb tr\u00ed c\u1ee7a m\u1ed9t ph\u1ea7n t\u1eed trong m\u1ea3ng. M\u1ea3ng Javascript \u0111\u01b0\u1ee3c l\u1eadp ch\u1ec9 m\u1ee5c b\u1eb1ng 0, ngh\u0129a l\u00e0 ph\u1ea7n t\u1eed \u0111\u1ea7u ti\u00ean c\u00f3 ch\u1ec9 m\u1ee5c l\u00e0 0.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>\u0110\u1ed9 d\u00e0i m\u1ea3ng (Array Length):<\/b><span style=\"font-weight: 400;\"> S\u1ed1 l\u01b0\u1ee3ng ph\u1ea7n t\u1eed trong m\u1ed9t m\u1ea3ng, c\u00f3 th\u1ec3 truy xu\u1ea5t b\u1eb1ng thu\u1ed9c t\u00ednh length.<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"12_phuong_thuc_co_ban_cua_Array_Javascript\"><\/span><b> 12 ph\u01b0\u01a1ng th\u1ee9c c\u01a1 b\u1ea3n c\u1ee7a Array Javascript\u00a0<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><b>Array Length<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Thu\u1ed9c t\u00ednh length c\u00f3 c\u00f4ng d\u1ee5ng tr\u1ea3 v\u1ec1 \u0111\u1ed9 d\u00e0i (k\u00edch th\u01b0\u1edbc) c\u1ee7a m\u1ed9t m\u1ea3ng:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">&lt;!DOCTYPE html&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>html<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>body<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>h1<\/b><span style=\"font-weight: 400;\">&gt;<\/span><span style=\"font-weight: 400;\">JavaScript Arrays<\/span><span style=\"font-weight: 400;\">&lt;\/<\/span><b>h1<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>h2<\/b><span style=\"font-weight: 400;\">&gt;<\/span><span style=\"font-weight: 400;\">The length Property<\/span><span style=\"font-weight: 400;\">&lt;\/<\/span><b>h2<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>p<\/b><span style=\"font-weight: 400;\">&gt;<\/span><span style=\"font-weight: 400;\">The length property returns the length of an array:<\/span><span style=\"font-weight: 400;\">&lt;\/<\/span><b>p<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>p<\/b><span style=\"font-weight: 400;\"> id=<\/span><span style=\"font-weight: 400;\">\"demo\"<\/span><span style=\"font-weight: 400;\">&gt;&lt;\/<\/span><b>p<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>script<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">const<\/span><span style=\"font-weight: 400;\"> fruits = [<\/span><span style=\"font-weight: 400;\">\"Banana\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Orange\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Apple\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Mango\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> size = fruits.length;<\/span>\r\n<span style=\"font-weight: 400;\">document<\/span><span style=\"font-weight: 400;\">.getElementById(<\/span><span style=\"font-weight: 400;\">\"demo\"<\/span><span style=\"font-weight: 400;\">).innerHTML = size;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>script<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>body<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>html<\/b><span style=\"font-weight: 400;\">&gt;<\/span><\/pre>\n<h3><b>ArraytoString()<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Ph\u01b0\u01a1ng th\u1ee9c Javascript toString() gi\u00fap chuy\u1ec3n \u0111\u1ed5i m\u1ed9t m\u1ea3ng th\u00e0nh m\u1ed9t chu\u1ed7i c\u00e1c gi\u00e1 tr\u1ecb m\u1ea3ng, \u0111\u01b0\u1ee3c ph\u00e2n t\u00e1ch b\u1eb1ng d\u1ea5u ph\u1ea9y.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">&lt;!DOCTYPE html&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>html<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>body<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>h1<\/b><span style=\"font-weight: 400;\">&gt;<\/span><span style=\"font-weight: 400;\">JavaScript Arrays<\/span><span style=\"font-weight: 400;\">&lt;\/<\/span><b>h1<\/b><span style=\"font-weight: 400;\">&gt;<\/span> \r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>h2<\/b><span style=\"font-weight: 400;\">&gt;<\/span><span style=\"font-weight: 400;\">The toString() Method<\/span><span style=\"font-weight: 400;\">&lt;\/<\/span><b>h2<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>p<\/b><span style=\"font-weight: 400;\">&gt;<\/span><span style=\"font-weight: 400;\">The toString() method returns an array as a comma separated string:<\/span><span style=\"font-weight: 400;\">&lt;\/<\/span><b>p<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>p<\/b><span style=\"font-weight: 400;\"> id=<\/span><span style=\"font-weight: 400;\">\"demo\"<\/span><span style=\"font-weight: 400;\">&gt;&lt;\/<\/span><b>p<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>script<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">const<\/span><span style=\"font-weight: 400;\"> fruits = [<\/span><span style=\"font-weight: 400;\">\"Banana\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Orange\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Apple\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Mango\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">document<\/span><span style=\"font-weight: 400;\">.getElementById(<\/span><span style=\"font-weight: 400;\">\"demo\"<\/span><span style=\"font-weight: 400;\">).innerHTML = fruits.toString();<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>script<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>body<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>html<\/b><span style=\"font-weight: 400;\">&gt;<\/span><\/pre>\n<h3><b>Array join()<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Ph\u01b0\u01a1ng ph\u00e1p join() gi\u00fap n\u1ed1i t\u1ea5t c\u1ea3 c\u00e1c ph\u1ea7n t\u1eed trong m\u1ea3ng th\u00e0nh m\u1ed9t chu\u1ed7i. Nh\u00ecn chung, join() ho\u1ea1t \u0111\u1ed9ng gi\u1ed1ng toString() nh\u01b0ng b\u1ea1n c\u00f3 th\u1ec3 ch\u1ec9 \u0111\u1ecbnh th\u00eam d\u1ea5u ph\u00e2n c\u00e1ch.\u00a0<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">const<\/span><span style=\"font-weight: 400;\"> fruits = [<\/span><span style=\"font-weight: 400;\">\"Banana\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Orange\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Apple\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Mango\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">document<\/span><span style=\"font-weight: 400;\">.getElementById(<\/span><span style=\"font-weight: 400;\">\"demo\"<\/span><span style=\"font-weight: 400;\">).innerHTML = fruits.join(<\/span><span style=\"font-weight: 400;\">\" * \"<\/span><span style=\"font-weight: 400;\">);<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>html<\/b><span style=\"font-weight: 400;\">&gt;<\/span><\/pre>\n<h3><b>Array pop() v\u00e0 push()<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Trong qu\u00e1 tr\u00ecnh khai b\u00e1o array, khi mu\u1ed1n th\u00eam ho\u1eb7c x\u00f3a b\u1edbt m\u1ed9t ph\u1ea7n t\u1eed trong m\u1ea3ng, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng pop() v\u00e0 push(). Trong khi pop() \u0111\u01b0\u1ee3c d\u00f9ng \u0111\u1ec3 x\u00f3a ph\u1ea7n t\u1eed cu\u1ed1i trong m\u1ea3ng th\u00ec push() c\u00f3 c\u00f4ng d\u1ee5ng th\u00eam m\u1ed9t ph\u1ea7n t\u1eed m\u1edbi v\u00e0o trong m\u1ea3ng.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Khi s\u1eed d\u1ee5ng pop() \u0111\u1ec3 x\u00f3a ph\u1ea7n t\u1eed, k\u1ebft qu\u1ea3 s\u1ebd tr\u1ea3 v\u1ec1 gi\u00e1 tr\u1ecb \u0111\u00e3 \u0111\u01b0\u1ee3c \u201cb\u1eadt ra\u201d.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">const fruits<\/span><span style=\"font-weight: 400;\"> = [<\/span><span style=\"font-weight: 400;\">\"Banana\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Orange\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Apple\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Mango\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">let fruit<\/span><span style=\"font-weight: 400;\"> = fruits.pop();<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">T\u01b0\u01a1ng t\u1ef1, khi b\u1ea1n th\u00eam m\u1ed9t ph\u1ea7n t\u1eed m\u1edbi v\u00e0o cu\u1ed1i m\u1ea3ng, b\u1ea1n s\u1ebd s\u1eed d\u1ee5ng push(). Push() s\u1ebd tr\u1ea3 v\u1ec1 k\u1ebft qu\u1ea3 l\u00e0 \u0111\u1ed9 d\u00e0i c\u1ee7a m\u1ea3ng m\u1edbi. C\u1ee5 th\u1ec3:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">const fruits<\/span><span style=\"font-weight: 400;\"> = [<\/span><span style=\"font-weight: 400;\">\"Banana\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Orange\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Apple\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Mango\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">let length<\/span><span style=\"font-weight: 400;\"> = fruits.push(<\/span><span style=\"font-weight: 400;\">\"Kiwi\"<\/span><span style=\"font-weight: 400;\">);<\/span><\/pre>\n<h3><b>Array shift()<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Shift() c\u00f3 c\u00f4ng d\u1ee5ng x\u00f3a ph\u1ea7n t\u1eed \u0111\u1ea7u ti\u00ean trong m\u1ea3ng v\u00e0 chuy\u1ec3n c\u00e1c ph\u1ea7n t\u1eed kh\u00e1c sang ch\u1ec9 m\u1ee5c th\u1ea5p h\u01a1n. Khi khai b\u00e1o, shift() s\u1ebd tr\u1ea3 v\u1ec1 gi\u00e1 tr\u1ecb m\u1ea3ng sau khi ph\u1ea7n t\u1eed \u0111\u00e3 \u0111\u01b0\u1ee3c chuy\u1ec3n ra.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">const fruits<\/span><span style=\"font-weight: 400;\"> = [<\/span><span style=\"font-weight: 400;\">\"Banana\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Orange\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Apple\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Mango\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">let fruit<\/span><span style=\"font-weight: 400;\"> = fruits.shift();<\/span><\/pre>\n<h3><b>Array unshift()<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Kh\u00e1c v\u1edbi shift(), unshift() s\u1ebd th\u00eam m\u1ed9t ph\u1ea7n t\u1eed m\u1edbi v\u00e0o m\u1ea3ng (\u1edf ph\u1ea7n \u0111\u1ea7u) v\u00e0 b\u1ecf d\u1ecbch chuy\u1ec3n \u1edf c\u00e1c ph\u1ea7n t\u1eed c\u0169 h\u01a1n. Khi tr\u1ea3 v\u1ec1 k\u1ebft qu\u1ea3, unshift() s\u1ebd tr\u1ea3 v\u1ec1 \u0111\u1ed9 d\u00e0i m\u1ea3ng m\u1edbi sau khi \u0111\u00e3 \u0111\u01b0\u1ee3c th\u00eam ph\u1ea7n t\u1eed v\u00e0o.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">const fruits = [<\/span><span style=\"font-weight: 400;\">\"Banana\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Orange\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Apple\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Mango\"<\/span><span style=\"font-weight: 400;\">]<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n<span style=\"font-weight: 400;\">fruits.unshift(<\/span><span style=\"font-weight: 400;\">\"Lemon\"<\/span><span style=\"font-weight: 400;\">)<\/span><span style=\"font-weight: 400;\">;<\/span><\/pre>\n<h3><b>Array concat()<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Trong Javascript, khi mu\u1ed1n th\u1ef1c hi\u1ec7n n\u1ed1i c\u00e1c m\u1ea3ng, ngh\u0129a l\u00e0 n\u1ed1i c\u00e1c m\u1ea3ng l\u1ea1i v\u1edbi nhau t\u1eeb \u0111\u1ea7u \u0111\u1ebfn cu\u1ed1i, b\u1ea1n s\u1ebd s\u1eed d\u1ee5ng ph\u01b0\u01a1ng th\u1ee9c concat() \u0111\u1ec3 t\u1ea1o ra m\u1ed9t m\u1ea3ng m\u1edbi ph\u00f9 h\u1ee3p v\u1edbi m\u1ea3ng hi\u1ec7n c\u00f3.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Ch\u1eb3ng h\u1ea1n nh\u01b0 khi n\u1ed1i hai m\u1ea3ng ri\u00eang bi\u1ec7t sau:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let myGirls<\/span><span style=\"font-weight: 400;\"> = [<\/span><span style=\"font-weight: 400;\">\"Cecilie\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Lone\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">let myBoys<\/span><span style=\"font-weight: 400;\"> = [<\/span><span style=\"font-weight: 400;\">\"Emil\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Tobias\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Linus\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n\r\n<span style=\"font-weight: 400;\">let myChildren<\/span><span style=\"font-weight: 400;\"> = myGirls.concat(myBoys);<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">B\u00ean c\u1ea1nh \u0111\u00f3, khi s\u1eed d\u1ee5ng ph\u01b0\u01a1ng ph\u00e1p concat(), b\u1ea1n n\u00ean l\u01b0u \u00fd m\u1ed9t s\u1ed1 \u0111i\u1ec1u nh\u01b0 sau:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">concat() kh\u00f4ng thay \u0111\u1ed5i c\u00e1c m\u1ea3ng hi\u1ec7n c\u00f3, k\u1ebft qu\u1ea3 tr\u1ea3 v\u1ec1 s\u1ebd l\u00e0 m\u1ed9t m\u1ea3ng m\u1edbi \u0111\u00e3 \u0111\u01b0\u1ee3c n\u1ed1i t\u1eeb ph\u1ea7n t\u1eed \u0111\u1ea7u ti\u00ean \u0111\u1ebfn cu\u1ed1i c\u00f9ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">concat() c\u00f3 th\u1ec3 l\u1ea5y b\u1ea5t k\u1ef3 s\u1ed1 l\u01b0\u1ee3ng \u0111\u1ed1i s\u1ed1 c\u1ee7a m\u1ea3ng ho\u1eb7c c\u00f3 th\u1ec3 l\u1ea5y chu\u1ed7i \u0111\u1ec3 l\u00e0m \u0111\u1ed1i s\u1ed1.<\/span><\/li>\n<\/ul>\n<h3><b>Array splice()<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">splice() \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 th\u00eam c\u00e1c m\u1ee5c m\u1edbi v\u00e0o trong m\u1ed9t m\u1ea3ng. Ch\u1eb3ng h\u1ea1n nh\u01b0:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">const fruits = [<\/span><span style=\"font-weight: 400;\">\"Banana\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Orange\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Apple\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Mango\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">fruits.splice(<\/span><span style=\"font-weight: 400;\">2<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">0<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Lemon\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Kiwi\"<\/span><span style=\"font-weight: 400;\">);<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">\u1ede v\u00ed d\u1ee5 tr\u00ean:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Tham s\u1ed1 \u0111\u1ea7u ti\u00ean (2) x\u00e1c \u0111\u1ecbnh v\u1ecb tr\u00ed m\u00e0 c\u00e1c ph\u1ea7n t\u1eed m\u1edbi s\u1ebd \u0111\u01b0\u1ee3c th\u00eam v\u00e0o (n\u1ed1i v\u00e0o)<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Tham s\u1ed1 0 x\u00e1c \u0111\u1ecbnh s\u1ed1 l\u01b0\u1ee3ng ph\u1ea7n t\u1eed b\u1ecb x\u00f3a<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">C\u00e1c tham s\u1ed1 c\u00f2n l\u1ea1i nh\u01b0 \u201cLemon\u201d v\u00e0 \u201cKiwi\u201d ch\u00ednh l\u00e0 ph\u1ea7n t\u1eed m\u1edbi s\u1ebd \u0111\u01b0\u1ee3c th\u00eam v\u00e0o.\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3 sau khi s\u1eed d\u1ee5ng splice() \u0111\u1ec3 th\u00eam ph\u1ea7n t\u1eed nh\u01b0 sau:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-77352\" src=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-2-vippro.jpg\" alt=\"array javascript - itviec blog\" width=\"538\" height=\"97\" srcset=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-2-vippro.jpg 538w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-2-vippro-300x54.jpg 300w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-2-vippro-200x36.jpg 200w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-2-vippro-100x18.jpg 100w\" sizes=\"auto, (max-width: 538px) 100vw, 538px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Ngo\u00e0i ra, b\u1ea1n c\u0169ng c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng splice() \u0111\u1ec3 x\u00f3a c\u00e1c ph\u1ea7n t\u1eed m\u00e0 kh\u00f4ng \u0111\u1ec3 xu\u1ea5t hi\u1ec7n kho\u1ea3ng tr\u1ed1ng trong kho\u1ea3ng. C\u1ee5 th\u1ec3:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">const fruits = [<\/span><span style=\"font-weight: 400;\">\"Banana\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Orange\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Apple\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Mango\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">fruits.splice(<\/span><span style=\"font-weight: 400;\">0<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">1<\/span><span style=\"font-weight: 400;\">);<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Trong \u0111\u00f3:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Tham s\u1ed1 0 \u0111\u1ea7u ti\u00ean x\u00e1c \u0111\u1ecbnh v\u1ecb tr\u00ed m\u00e0 c\u00e1c ph\u1ea7n t\u1eed m\u1edbi s\u1ebd \u0111\u01b0\u1ee3c th\u00eam v\u00e0o.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Tham s\u1ed1 th\u1ee9 hai l\u00e0 s\u1ed1 1 x\u00e1c \u0111\u1ecbnh s\u1ed1 l\u01b0\u1ee3ng ph\u1ea7n t\u1eed s\u1ebd b\u1ecb x\u00f3a.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">C\u00e1c tham s\u1ed1 c\u00f2n l\u1ea1i \u0111\u01b0\u1ee3c b\u1ecf qua v\u00ec kh\u00f4ng c\u00f3 ph\u1ea7n t\u1eed m\u1edbi \u0111\u01b0\u1ee3c th\u00eam v\u00e0o.<\/span><\/li>\n<\/ul>\n<p>K\u1ebft qu\u1ea3 hi\u1ec3n th\u1ecb:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-77351\" src=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-3-vippro.jpg\" alt=\"array javascript - itviec blog\" width=\"507\" height=\"108\" srcset=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-3-vippro.jpg 507w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-3-vippro-300x64.jpg 300w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-3-vippro-200x43.jpg 200w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-3-vippro-100x21.jpg 100w\" sizes=\"auto, (max-width: 507px) 100vw, 507px\" \/><\/p>\n<h3><b>Array slice()<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">slice() trong Array c\u00f3 c\u00f4ng d\u1ee5ng c\u1eaft m\u1ed9t ph\u1ea7n t\u1eed c\u1ee7a m\u1ea3ng th\u00e0nh m\u1ed9t m\u1ea3ng m\u1edbi. Ch\u00fang c\u00f3 c\u00f4ng d\u1ee5ng t\u1ea1o m\u1ed9t m\u1ea3ng m\u1edbi v\u00e0 kh\u00f4ng x\u00f3a b\u1ea5t k\u1ef3 ph\u1ea7n t\u1eed n\u00e0o kh\u1ecfi m\u1ea3ng ngu\u1ed3n.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">const fruits<\/span><span style=\"font-weight: 400;\"> = [<\/span><span style=\"font-weight: 400;\">\"Banana\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Orange\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Lemon\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Apple\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Mango\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">const citrus<\/span><span style=\"font-weight: 400;\"> = fruits.slice(1, 3);<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Ph\u01b0\u01a1ng th\u1ee9c slice() c\u00f3 th\u1ec3 l\u1ea5y hai \u0111\u1ed1i s\u1ed1 nh\u01b0 slice(1,3) v\u00e0 ch\u1ecdn c\u00e1c ph\u1ea7n t\u1eed t\u1eeb s\u1ed1 b\u1eaft \u0111\u1ea7u v\u00e0 l\u00ean \u0111\u1ebfn \u0111\u1ed1i s\u1ed1 k\u1ebft th\u00fac trong m\u1ea3ng. N\u1ebfu \u0111\u1ed1i s\u1ed1 k\u1ebft th\u00fac b\u1ecb b\u1ecf qua, slice() s\u1ebd c\u1eaft ph\u1ea7n c\u00f2n l\u1ea1i c\u1ee7a m\u1ea3ng.<\/span><\/p>\n<h3><b>Array find()<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Ph\u01b0\u01a1ng th\u1ee9c find() c\u00f3 ch\u1ee9c n\u0103ng tr\u1ea3 v\u1ec1 gi\u00e1 tr\u1ecb c\u1ee7a ph\u1ea7n t\u1eed m\u1ea3ng \u0111\u1ea7u ti\u00ean qua h\u00e0m ki\u1ec3m tra (a test function). H\u00e0m n\u00e0y c\u00f3 3 \u0111\u1ed1i s\u1ed1 ch\u1ee7 y\u1ebfu l\u00e0 gi\u00e1 tr\u1ecb (value), ch\u1ec9 m\u1ee5c (index) v\u00e0 m\u1ea3ng (array).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 hi\u1ec3u r\u00f5 h\u01a1n v\u1ec1 c\u00e1ch ho\u1ea1t \u0111\u1ed9ng c\u1ee7a find(), b\u1ea1n c\u00f3 th\u1ec3 xem qua v\u00ed d\u1ee5 sau: T\u00ecm (tr\u1ea3 v\u1ec1 gi\u00e1 tr\u1ecb) ph\u1ea7n t\u1eed \u0111\u1ea7u ti\u00ean l\u1edbn h\u01a1n 18 nh\u01b0 sau:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">const<\/span><span style=\"font-weight: 400;\"> numbers = [<\/span><span style=\"font-weight: 400;\">4<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">9<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">16<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">25<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">29<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> first = numbers.find(myFunction);<\/span>\r\n\r\n<span style=\"font-weight: 400;\">function <\/span><span style=\"font-weight: 400;\">myFunction<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">value<\/span><span style=\"font-weight: 400;\">, index, array) {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 <\/span><span style=\"font-weight: 400;\">return<\/span> <span style=\"font-weight: 400;\">value<\/span><span style=\"font-weight: 400;\"> &gt; <\/span><span style=\"font-weight: 400;\">18<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b>Array sort()<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Khi mu\u1ed1n s\u1eafp x\u1ebfp d\u1eef li\u1ec7u m\u1ea3ng trong m\u00e3, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng ph\u01b0\u01a1ng th\u1ee9c sort() \u0111\u1ec3 th\u1ef1c hi\u1ec7n s\u1eafp x\u1ebfp theo th\u1ee9 t\u1ef1 t\u1eeb A-Z. V\u00ed d\u1ee5 nh\u01b0:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">const fruits = [<\/span><span style=\"font-weight: 400;\">\"Banana\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Orange\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Apple\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Mango\"<\/span><span style=\"font-weight: 400;\">]<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n<span style=\"font-weight: 400;\">fruits.sort()<\/span><span style=\"font-weight: 400;\">;<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3 hi\u1ec3n th\u1ecb:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-77349\" src=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-5-vippro.jpg\" alt=\"array javascript - itviec blog\" width=\"523\" height=\"120\" srcset=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-5-vippro.jpg 523w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-5-vippro-300x69.jpg 300w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-5-vippro-200x46.jpg 200w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-5-vippro-100x23.jpg 100w\" sizes=\"auto, (max-width: 523px) 100vw, 523px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Ngo\u00e0i ra, Array Javascript c\u0169ng c\u00f3 th\u00eam ph\u01b0\u01a1ng th\u1ee9c toSorted() nh\u01b0 m\u1ed9t c\u00e1ch an to\u00e0n \u0111\u1ec3 th\u1ef1c hi\u1ec7n s\u1eafp x\u1ebfp m\u1ea3ng m\u00e0 kh\u00f4ng l\u00e0m thay \u0111\u1ed5i c\u1ea5u tr\u00fac m\u1ea3ng g\u1ed1c.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">S\u1ef1 kh\u00e1c bi\u1ec7t gi\u1eefa toSorted() v\u00e0 sort() l\u00e0 toSorted() cho ph\u00e9p t\u1ea1o m\u1ed9t m\u1ea3ng m\u1edbi v\u00e0 v\u1eabn gi\u1eef nguy\u00ean m\u1ea3ng g\u1ed1c trong khi sort() c\u00f3 th\u1ec3 l\u00e0m thay \u0111\u1ed5i m\u1ea3ng g\u1ed1c.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">const months<\/span><span style=\"font-weight: 400;\"> = [<\/span><span style=\"font-weight: 400;\">\"Jan\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Feb\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Mar\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Apr\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">const sorted<\/span><span style=\"font-weight: 400;\"> = months.toSorted();<\/span><\/pre>\n<h3><b>Array reverse()<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">C\u00e1ch ho\u1ea1t \u0111\u1ed9ng c\u1ee7a reverse() gi\u00fap \u0111\u1ea3o ng\u01b0\u1ee3c c\u00e1c ph\u1ea7n t\u1eed trong m\u1ed9t m\u1ea3ng, c\u1ee5 th\u1ec3 nh\u01b0:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">const fruits = [<\/span><span style=\"font-weight: 400;\">\"Banana\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Orange\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Apple\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Mango\"<\/span><span style=\"font-weight: 400;\">]<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n<span style=\"font-weight: 400;\">fruits.reverse()<\/span><span style=\"font-weight: 400;\">;<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3 hi\u1ec3n th\u1ecb:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-77348\" src=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-6-vippro.jpg\" alt=\"array javascript - itviec blog\" width=\"429\" height=\"109\" srcset=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-6-vippro.jpg 429w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-6-vippro-300x76.jpg 300w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-6-vippro-200x51.jpg 200w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-6-vippro-100x25.jpg 100w\" sizes=\"auto, (max-width: 429px) 100vw, 429px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">B\u00ean c\u1ea1nh \u0111\u00f3, khi k\u1ebft h\u1ee3p sort() v\u00e0 reverse(), b\u1ea1n c\u00f3 th\u1ec3 th\u1ef1c hi\u1ec7n s\u1eafp x\u1ebfp m\u1ed9t m\u1ea3ng theo th\u1ee9 t\u1ef1 gi\u1ea3m d\u1ea7n, nh\u01b0 sau:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">const fruits = [<\/span><span style=\"font-weight: 400;\">\"Banana\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Orange\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Apple\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Mango\"<\/span><span style=\"font-weight: 400;\">]<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n<span style=\"font-weight: 400;\">fruits.sort()<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n<span style=\"font-weight: 400;\">fruits.reverse()<\/span><span style=\"font-weight: 400;\">;<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3 hi\u1ec3n th\u1ecb:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-77347\" src=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-7-vippro.jpg\" alt=\"array javascript - itviec blog\" width=\"474\" height=\"100\" srcset=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-7-vippro.jpg 474w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-7-vippro-300x63.jpg 300w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-7-vippro-200x42.jpg 200w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-7-vippro-100x21.jpg 100w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/p>\n<blockquote><p><span style=\"font-weight: 400;\">B\u00ean c\u1ea1nh 12 ph\u01b0\u01a1ng th\u1ee9c c\u01a1 b\u1ea3n, Array Javascript c\u00f2n c\u00f3 m\u1ed9t s\u1ed1 ph\u01b0\u01a1ng th\u1ee9c nh\u01b0 map(), filter(), reduce(), some(), every(), includes(),&#8230;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 t\u00ecm hi\u1ec3u th\u00eam v\u1ec1 ph\u01b0\u01a1ng th\u1ee9c c\u1ee7a Array Javascript qua c\u00e1c ngu\u1ed3n t\u00e0i nguy\u00ean ch\u1ea5t l\u01b0\u1ee3ng nh\u01b0 <\/span><a href=\"https:\/\/www.freecodecamp.org\/news\/\"><span style=\"font-weight: 400;\">FreeCodeCamp<\/span><\/a><span style=\"font-weight: 400;\">, <\/span><a href=\"https:\/\/www.w3schools.com\/\"><span style=\"font-weight: 400;\">W3School<\/span><\/a><span style=\"font-weight: 400;\"> hay <\/span><a href=\"https:\/\/developer.mozilla.org\/en-US\/\"><span style=\"font-weight: 400;\">MDN Web Docs<\/span><\/a><span style=\"font-weight: 400;\"> \u0111\u1ec3 n\u00e2ng cao th\u00eam \u201ctay ngh\u1ec1\u201d l\u1eadp tr\u00ecnh c\u1ee7a m\u00ecnh nh\u00e9!<\/span><\/p><\/blockquote>\n<h2><span class=\"ez-toc-section\" id=\"Cach_khai_bao_Array_Javascript\"><\/span><b>C\u00e1ch khai b\u00e1o Array Javascript<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Khi khai b\u00e1o Array, b\u1ea1n c\u00f3 th\u1ec3 th\u1ef1c hi\u1ec7n m\u1ed9t trong hai c\u00e1ch l\u00e0 Array Literal v\u00e0 Array Constructor.<\/span><\/p>\n<h3><b>T\u1ea1o Array b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng Array Literal<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">T\u1ea1o Array b\u1eb1ng c\u00e1ch d\u00f9ng Literal s\u1ebd s\u1eed d\u1ee5ng d\u1ea5u ngo\u1eb7c vu\u00f4ng [] \u0111\u1ec3 \u0111\u1ecbnh ngh\u0129a v\u00e0 t\u1ea1o m\u1ea3ng. Ph\u01b0\u01a1ng ph\u00e1p n\u00e0y c\u00f3 c\u00fa ph\u00e1p ng\u1eafn g\u1ecdn v\u00e0 th\u01b0\u1eddng \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng nhi\u1ec1u b\u1edfi v\u00ec t\u00ednh \u0111\u01a1n gi\u1ea3n c\u1ee7a ch\u00fang. C\u00fa ph\u00e1p c\u01a1 b\u1ea3n c\u1ee7a Array Literal nh\u01b0 sau:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> arrayName = [<\/span><span style=\"font-weight: 400;\">value<\/span><span style=\"font-weight: 400;\">1<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">value<\/span><span style=\"font-weight: 400;\">2<\/span><span style=\"font-weight: 400;\">, ...];<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">&lt;!DOCTYPE html&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>html<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>body<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>h1<\/b><span style=\"font-weight: 400;\">&gt;<\/span><span style=\"font-weight: 400;\">JavaScript Arrays<\/span><span style=\"font-weight: 400;\">&lt;\/<\/span><b>h1<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>p<\/b><span style=\"font-weight: 400;\"> id=<\/span><span style=\"font-weight: 400;\">\"demo\"<\/span><span style=\"font-weight: 400;\">&gt;&lt;\/<\/span><b>p<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>script<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> cars = [<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 <\/span><span style=\"font-weight: 400;\">\"Saab\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 <\/span><span style=\"font-weight: 400;\">\"Volvo\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 <\/span><span style=\"font-weight: 400;\">\"BMW\"<\/span>\r\n<span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">document<\/span><span style=\"font-weight: 400;\">.getElementById(<\/span><span style=\"font-weight: 400;\">\"demo\"<\/span><span style=\"font-weight: 400;\">).innerHTML = cars;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>script<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>body<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>html<\/b><span style=\"font-weight: 400;\">&gt;<\/span><\/pre>\n<h3><b>T\u1ea1o Array b\u1eb1ng c\u00e1ch Array Constructor<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Array Constructor l\u00e0 ph\u01b0\u01a1ng ph\u00e1p t\u1ea1o m\u1ea3ng b\u1eb1ng c\u00e1ch d\u00f9ng h\u00e0m Array constructor. Ph\u01b0\u01a1ng ph\u00e1p n\u00e0y cho ph\u00e9p kh\u1edfi \u0111\u1ed9ng v\u00e0 c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 t\u1ea1o m\u1ea3ng c\u00f3 \u0111\u1ed9 d\u00e0i ho\u1eb7c ph\u1ea7n t\u1eed \u0111\u01b0\u1ee3c ch\u1ec9 \u0111\u1ecbnh. C\u00fa ph\u00e1p c\u01a1 b\u1ea3n c\u1ee7a ph\u01b0\u01a1ng ph\u00e1p n\u00e0y nh\u01b0 sau:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> arrayName = <\/span><span style=\"font-weight: 400;\">new<\/span> <span style=\"font-weight: 400;\">Array<\/span><span style=\"font-weight: 400;\">();<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5:\u00a0<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">&lt;!DOCTYPE html&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>html<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>body<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>h1<\/b><span style=\"font-weight: 400;\">&gt;<\/span><span style=\"font-weight: 400;\">JavaScript Arrays<\/span><span style=\"font-weight: 400;\">&lt;\/<\/span><b>h1<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>p<\/b><span style=\"font-weight: 400;\"> id=<\/span><span style=\"font-weight: 400;\">\"demo\"<\/span><span style=\"font-weight: 400;\">&gt;&lt;\/<\/span><b>p<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>script<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> cars = <\/span><span style=\"font-weight: 400;\">new<\/span> <span style=\"font-weight: 400;\">Array<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">\"Saab\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Volvo\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"BMW\"<\/span><span style=\"font-weight: 400;\">);<\/span>\r\n<span style=\"font-weight: 400;\">document<\/span><span style=\"font-weight: 400;\">.getElementById(<\/span><span style=\"font-weight: 400;\">\"demo\"<\/span><span style=\"font-weight: 400;\">).innerHTML = cars;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>script<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>body<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>html<\/b><span style=\"font-weight: 400;\">&gt;<\/span><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Thao_tac_co_ban_voi_Array_Javascript\"><\/span><b> Thao t\u00e1c c\u01a1 b\u1ea3n v\u1edbi Array Javascript<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><b>Truy c\u1eadp ph\u1ea7n t\u1eed c\u1ee7a Array<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">B\u1ea5t k\u1ef3 ph\u1ea7n t\u1eed n\u00e0o trong m\u1ea3ng \u0111\u1ec1u c\u00f3 th\u1ec3 truy c\u1eadp b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng s\u1ed1 ch\u1ec9 m\u1ee5c (index number). Ch\u1ec9 m\u1ee5c trong m\u1ea3ng th\u01b0\u1eddng b\u1eaft \u0111\u1ea7u b\u1eb1ng 0.\u00a0<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> courses = [<\/span><span style=\"font-weight: 400;\">\"HTML\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"CSS\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Javascript\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"React\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n\r\n<span style=\"font-weight: 400;\">console.<\/span><span style=\"font-weight: 400;\">log<\/span><span style=\"font-weight: 400;\">(courses[<\/span><span style=\"font-weight: 400;\">0<\/span><span style=\"font-weight: 400;\">]);<\/span>\r\n<span style=\"font-weight: 400;\">console.<\/span><span style=\"font-weight: 400;\">log<\/span><span style=\"font-weight: 400;\">(courses[<\/span><span style=\"font-weight: 400;\">1<\/span><span style=\"font-weight: 400;\">]);<\/span>\r\n<span style=\"font-weight: 400;\">console.<\/span><span style=\"font-weight: 400;\">log<\/span><span style=\"font-weight: 400;\">(courses[<\/span><span style=\"font-weight: 400;\">2<\/span><span style=\"font-weight: 400;\">]);<\/span>\r\n<span style=\"font-weight: 400;\">console.<\/span><span style=\"font-weight: 400;\">log<\/span><span style=\"font-weight: 400;\">(courses[<\/span><span style=\"font-weight: 400;\">3<\/span><span style=\"font-weight: 400;\">]);<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3 hi\u1ec3n th\u1ecb c\u1ee7a \u0111o\u1ea1n m\u00e3 tr\u00ean nh\u01b0 sau:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">HTML<\/span>\r\n\r\n<span style=\"font-weight: 400;\">CSS<\/span>\r\n\r\n<span style=\"font-weight: 400;\">Javascript<\/span>\r\n\r\n<span style=\"font-weight: 400;\">React<\/span><\/pre>\n<h3><b>Truy c\u1eadp ph\u1ea7n t\u1eed \u0111\u1ea7u ti\u00ean c\u1ee7a Array<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">C\u00e1c ch\u1ec9 s\u1ed1 m\u1ea3ng b\u1eaft \u0111\u1ea7u t\u1eeb 0, do \u0111\u00f3 b\u1ea1n c\u00f3 th\u1ec3 truy c\u1eadp ph\u1ea7n t\u1eed \u0111\u1ea7u ti\u00ean c\u1ee7a m\u1ea3ng b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng ch\u1ec9 s\u1ed1 \u0111\u00f3.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> courses = [<\/span><span style=\"font-weight: 400;\">\"HTML\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"CSS\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"JavaScript\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"React\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n\r\n<span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> firstItem = courses[<\/span><span style=\"font-weight: 400;\">0<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n\r\n<span style=\"font-weight: 400;\">console.log(<\/span><span style=\"font-weight: 400;\">\"First Item: \"<\/span><span style=\"font-weight: 400;\">, firstItem);<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">L\u00fac n\u00e0y, k\u1ebft qu\u1ea3 s\u1ebd hi\u1ec3n th\u1ecb ph\u1ea7n t\u1eed \u0111\u1ea7u ti\u00ean trong m\u1ea3ng ch\u00ednh l\u00e0 HTML.\u00a0<\/span><\/p>\n<h3><b>Truy c\u1eadp ph\u1ea7n t\u1eed cu\u1ed1i c\u00f9ng c\u1ee7a Array<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 th\u1ef1c hi\u1ec7n truy c\u1eadp ph\u1ea7n t\u1eed m\u1ea3ng cu\u1ed1i c\u00f9ng b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng s\u1ed1 ch\u1ec9 m\u1ee5c [array.length-1].<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> courses = [<\/span><span style=\"font-weight: 400;\">\"HTML\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"CSS\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"JavaScript\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"React\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n\r\n<span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> lastItem = courses[courses.<\/span><span style=\"font-weight: 400;\">length<\/span><span style=\"font-weight: 400;\"> - <\/span><span style=\"font-weight: 400;\">1<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n\r\n<span style=\"font-weight: 400;\">console.<\/span><span style=\"font-weight: 400;\">log<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">\"First Item: \"<\/span><span style=\"font-weight: 400;\">, lastItem);<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Sau khi th\u1ef1c hi\u1ec7n l\u1ec7nh tr\u00ean, k\u1ebft qu\u1ea3 s\u1ebd hi\u1ec3n th\u1ecb ph\u1ea7n t\u1eed cu\u1ed1i trong m\u1ea3ng l\u00e0 React.\u00a0<\/span><\/p>\n<h3><b>S\u1eeda \u0111\u1ed5i c\u00e1c ph\u1ea7n t\u1eed M\u1ea3ng<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 th\u1ef1c hi\u1ec7n s\u1eeda \u0111\u1ed5i c\u00e1c ph\u1ea7n t\u1eed trong m\u1ea3ng b\u1eb1ng c\u00e1ch g\u00e1n tr\u1ecb m\u1edbi cho ch\u1ec9 m\u1ee5c t\u01b0\u01a1ng \u1ee9ng c\u1ee7a ch\u00fang. C\u1ee5 th\u1ec3 nh\u01b0 sau:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let courses = [<\/span><span style=\"font-weight: 400;\">\"HTML\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"CSS\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Javascript\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"React\"<\/span><span style=\"font-weight: 400;\">]<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n<span style=\"font-weight: 400;\">console.log(courses)<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">courses[<\/span><span style=\"font-weight: 400;\">1<\/span><span style=\"font-weight: 400;\">]= <\/span><span style=\"font-weight: 400;\">\"Bootstrap\"<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n<span style=\"font-weight: 400;\">console.log(courses)<\/span><span style=\"font-weight: 400;\">;<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3 hi\u1ec3n th\u1ecb sau khi b\u1ea1n th\u1ef1c hi\u1ec7n l\u1ec7nh \u0111\u1ed5i ph\u1ea7n t\u1eed CSS sang Boostrap.\u00a0<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">[ 'HTML', 'CSS', 'Javascript', 'React' ]<\/span>\r\n\r\n<span style=\"font-weight: 400;\">[ 'HTML', 'Bootstrap', 'Javascript', 'React' ]<\/span><\/pre>\n<h3><b>Th\u00eam ph\u1ea7n t\u1eed v\u00e0o M\u1ea3ng<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 ti\u1ebfn h\u00e0nh th\u00eam m\u1ed9t ho\u1eb7c m\u1ed9t s\u1ed1 ph\u1ea7n t\u1eed v\u00e0o m\u1ea3ng, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng push() ho\u1eb7c unshift(). C\u00e1ch th\u1ef1c hi\u1ec7n c\u1ee5 th\u1ec3 nh\u01b0:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let courses = [<\/span><span style=\"font-weight: 400;\">\"HTML\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"CSS\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Javascript\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"React\"<\/span><span style=\"font-weight: 400;\">]<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">courses.push(<\/span><span style=\"font-weight: 400;\">\"Node.js\"<\/span><span style=\"font-weight: 400;\">)<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">courses.unshift(<\/span><span style=\"font-weight: 400;\">\"Web Development\"<\/span><span style=\"font-weight: 400;\">)<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">console.log(courses)<\/span><span style=\"font-weight: 400;\">;<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3 hi\u1ec3n th\u1ecb nh\u01b0 sau:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">[ 'Web Development', 'HTML', 'CSS', 'Javascript', 'React', 'Node.js' ]<\/span><\/pre>\n<h3><b>Lo\u1ea1i m\u1ed9t ph\u1ea7n t\u1eed kh\u1ecfi M\u1ea3ng<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Khi b\u1ea1n mu\u1ed1n x\u00f3a c\u00e1c ph\u1ea7n t\u1eed kh\u00f4ng c\u00f2n c\u1ea7n thi\u1ebft trong m\u1ea3ng, c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng ph\u01b0\u01a1ng th\u1ee9c pop(), shift() ho\u1eb7c splice(). C\u1ee5 th\u1ec3 nh\u01b0:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> courses = [<\/span><span style=\"font-weight: 400;\">\"HTML\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"CSS\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Javascript\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"React\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Node.js\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">console.<\/span><span style=\"font-weight: 400;\">log<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">\"Original Array: \"<\/span><span style=\"font-weight: 400;\"> + courses);<\/span>\r\n\r\n<span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> lastElement = courses.<\/span><span style=\"font-weight: 400;\">pop<\/span><span style=\"font-weight: 400;\">();<\/span>\r\n<span style=\"font-weight: 400;\">console.<\/span><span style=\"font-weight: 400;\">log<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">\"After Removing the last elements: \"<\/span><span style=\"font-weight: 400;\"> + courses);<\/span>\r\n\r\n<span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> firstElement = courses.shift();<\/span>\r\n<span style=\"font-weight: 400;\">console.<\/span><span style=\"font-weight: 400;\">log<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">\"After Removing the First elements: \"<\/span><span style=\"font-weight: 400;\"> + courses);<\/span>\r\n\r\n<span style=\"font-weight: 400;\">courses.<\/span><span style=\"font-weight: 400;\">splice<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">1<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">2<\/span><span style=\"font-weight: 400;\">);<\/span>\r\n<span style=\"font-weight: 400;\">console.<\/span><span style=\"font-weight: 400;\">log<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">\"After Removing 2 elements starting from index 1: \"<\/span><span style=\"font-weight: 400;\"> + courses);<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3 hi\u1ec3n th\u1ecb cho \u0111o\u1ea1n m\u00e3 tr\u00ean nh\u01b0 sau:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Original Array: HTML,CSS,Javascript,React,Node.js<\/span>\r\n\r\n<span style=\"font-weight: 400;\">After Removing the last elements: HTML,CSS,Javascript,React<\/span>\r\n\r\n<span style=\"font-weight: 400;\">After Removing the First elements: CSS,Javascript,React<\/span>\r\n\r\n<span style=\"font-weight: 400;\">After Removing 2 elements starting from index 1: CSS<\/span><\/pre>\n<h3><b>Array Length<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u0110\u1ed1i v\u1edbi m\u1ed9t \u0111o\u1ea1n m\u00e3 d\u00e0i v\u00e0 c\u00f3 nhi\u1ec1u ph\u1ea7n t\u1eed, \u0111\u1ec3 bi\u1ebft \u0111\u01b0\u1ee3c trong m\u1ea3ng \u0111\u00f3 c\u00f3 bao nhi\u00eau ph\u1ea7n t\u1eed, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng thu\u1ed9c t\u00ednh length. C\u1ee5 th\u1ec3 nh\u01b0 sau:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> courses = [<\/span><span style=\"font-weight: 400;\">\"HTML\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"CSS\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Javascript\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"React\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Node.js\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">let<\/span> <span style=\"font-weight: 400;\">len<\/span><span style=\"font-weight: 400;\"> = courses.length;<\/span>\r\n<span style=\"font-weight: 400;\">console.<\/span><span style=\"font-weight: 400;\">log<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">\"Array Length: \"<\/span><span style=\"font-weight: 400;\"> + <\/span><span style=\"font-weight: 400;\">len<\/span><span style=\"font-weight: 400;\">);<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Khi \u0111\u00f3, k\u1ebft qu\u1ea3 s\u1ebd hi\u1ec3n th\u1ecb \u0111\u1ed9 d\u00e0i c\u1ee7a m\u1ea3ng l\u00e0 5.<\/span><\/p>\n<h3><b>T\u0103ng v\u00e0 gi\u1ea3m \u0111\u1ed9 d\u00e0i c\u1ee7a M\u1ea3ng<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Khi th\u1ef1c hi\u1ec7n t\u0103ng ho\u1eb7c gi\u1ea3m \u0111\u1ed9 d\u00e0i c\u1ee7a M\u1ea3ng b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng thu\u1ed9c t\u00ednh length trong Javascript. C\u1ee5 th\u1ec3 nh\u01b0 sau:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> courses = [<\/span><span style=\"font-weight: 400;\">\"HTML\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"CSS\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Javascript\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"React\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Node.js\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">courses.<\/span><span style=\"font-weight: 400;\">length<\/span><span style=\"font-weight: 400;\"> = <\/span><span style=\"font-weight: 400;\">7<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n<span style=\"font-weight: 400;\">console.<\/span><span style=\"font-weight: 400;\">log<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">\"Array After Increase the Length: \"<\/span><span style=\"font-weight: 400;\">, courses);<\/span>\r\n<span style=\"font-weight: 400;\">courses.<\/span><span style=\"font-weight: 400;\">length<\/span><span style=\"font-weight: 400;\"> = <\/span><span style=\"font-weight: 400;\">2<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n<span style=\"font-weight: 400;\">console.<\/span><span style=\"font-weight: 400;\">log<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">\"Array After Decrease the Length: \"<\/span><span style=\"font-weight: 400;\">, courses)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3 hi\u1ec3n th\u1ecb sau khi th\u1ef1c hi\u1ec7n \u0111o\u1ea1n m\u00e3 tr\u00ean:\u00a0<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Array After Increase the Length:\u00a0 [ 'HTML', 'CSS', 'Javascript', 'React', 'Node.js', &lt;2 empty items&gt; ]<\/span>\r\n\r\n<span style=\"font-weight: 400;\">Array After Decrease the Length:\u00a0 [ 'HTML', 'CSS' ]<\/span><\/pre>\n<h3><b>L\u1eb7p l\u1ea1i c\u00e1c ph\u1ea7n t\u1eed M\u1ea3ng<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 l\u1eb7p l\u1ea1i m\u1ea3ng v\u00e0 truy c\u1eadp c\u00e1c ph\u1ea7n t\u1eed m\u1ea3ng b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng for v\u00e0 forEach loop. C\u1ee5 th\u1ec3 khi s\u1eed d\u1ee5ng for:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> courses = [<\/span><span style=\"font-weight: 400;\">\"HTML\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"CSS\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"JavaScript\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"React\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">for<\/span><span style=\"font-weight: 400;\"> (<\/span><span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> i = <\/span><span style=\"font-weight: 400;\">0<\/span><span style=\"font-weight: 400;\">; i &lt; courses.<\/span><span style=\"font-weight: 400;\">length<\/span><span style=\"font-weight: 400;\">; i++) {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 console.<\/span><span style=\"font-weight: 400;\">log<\/span><span style=\"font-weight: 400;\">(courses[i])<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Ho\u1eb7c khi b\u1ea1n s\u1eed d\u1ee5ng ForEach loop:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> courses = [<\/span><span style=\"font-weight: 400;\">\"HTML\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"CSS\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"JavaScript\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"React\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">courses.forEach(<\/span><span style=\"font-weight: 400;\">function<\/span> <span style=\"font-weight: 400;\">myfunc<\/span><span style=\"font-weight: 400;\">(elements) {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">console<\/span><span style=\"font-weight: 400;\">.log(elements);<\/span>\r\n<span style=\"font-weight: 400;\">});<\/span><\/pre>\n<h3><b>N\u1ed1i M\u1ea3ng (Array Concatenation)<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Khi b\u1ea1n th\u1ef1c hi\u1ec7n k\u1ebft h\u1ee3p hai ho\u1eb7c nhi\u1ec1u m\u1ea3ng b\u1eb1ng ph\u01b0\u01a1ng th\u1ee9c concat() th\u00ec tr\u00ecnh duy\u1ec7t s\u1ebd tr\u1ea3 v\u1ec1 m\u1ed9t m\u1ea3ng m\u1edbi ch\u1ee9a c\u00e1c ph\u1ea7n t\u1eed t\u1eeb c\u00e1c m\u1ea3ng \u0111\u00e3 k\u1ebft h\u1ee3p. C\u1ee5 th\u1ec3:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> courses = [<\/span><span style=\"font-weight: 400;\">\"HTML\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"CSS\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"JavaScript\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"React\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> otherCourses = [<\/span><span style=\"font-weight: 400;\">\"Node.js\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Expess.js\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> concateArray = courses.concat(otherCourses);<\/span>\r\n<span style=\"font-weight: 400;\">console.log(<\/span><span style=\"font-weight: 400;\">\"Concatenated Array: \"<\/span><span style=\"font-weight: 400;\">, concateArray);<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3 s\u1ebd tr\u1ea3 v\u1ec1 nh\u01b0 sau:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Concatenated Array:\u00a0 [ 'HTML', 'CSS', 'JavaScript', 'React', 'Node.js', 'Expess.js' ]<\/span><\/pre>\n<h3><b>Chuy\u1ec3n \u0111\u1ed5i Array sang Chu\u1ed7i (String)<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Khi th\u1ef1c hi\u1ec7n chuy\u1ec3n \u0111\u1ed5i t\u1eeb M\u1ea3ng (Array) sang chu\u1ed7i (String), b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng ph\u01b0\u01a1ng ph\u00e1p <\/span><span style=\"font-weight: 400;\">toString()<\/span><span style=\"font-weight: 400;\"> t\u00edch h\u1ee3p \u0111\u1ec3 th\u1ef1c hi\u1ec7n qu\u00e1 tr\u00ecnh n\u00e0y. C\u1ee5 th\u1ec3:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> courses = [<\/span><span style=\"font-weight: 400;\">\"HTML\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"CSS\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"JavaScript\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"React\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">console.log(courses.<\/span><span style=\"font-weight: 400;\">toString<\/span><span style=\"font-weight: 400;\">());<\/span><\/pre>\n<h3><b>Ki\u1ec3m tra lo\u1ea1i c\u1ee7a M\u1ea3ng<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 th\u1ef1c hi\u1ec7n ki\u1ec3m tra ki\u1ec3u c\u1ee7a m\u1ed9t M\u1ea3ng, b\u1ea1n s\u1eed d\u1ee5ng to\u00e1n t\u1eed Javascript <\/span><span style=\"font-weight: 400;\">typeof<\/span><span style=\"font-weight: 400;\">. Khi tr\u1ea3 k\u1ebft qu\u1ea3, ch\u00fang s\u1ebd tr\u1ea3 v\u1ec1 object cho c\u00e1c m\u1ea3ng. C\u1ee5 th\u1ec3:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">let<\/span><span style=\"font-weight: 400;\"> courses = [<\/span><span style=\"font-weight: 400;\">\"HTML\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"CSS\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"JavaScript\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"React\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">console<\/span><span style=\"font-weight: 400;\">.log(<\/span><span style=\"font-weight: 400;\">typeof<\/span><span style=\"font-weight: 400;\"> courses);<\/span><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Cau_hoi_thuong_gap_ve_Array_Javascript\"><\/span><b> C\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 Array Javascript<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><b>Khi n\u00e0o n\u00ean s\u1eed d\u1ee5ng Array Javascript?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">B\u1ea1n n\u00ean s\u1eed d\u1ee5ng khai b\u00e1o Array Javascript khi:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">C\u1ea7n l\u01b0u tr\u1eef m\u1ed9t danh s\u00e1ch c\u00e1c gi\u00e1 tr\u1ecb c\u00f3 th\u1ee9 t\u1ef1 v\u00e0 th\u1ef1c hi\u1ec7n ph\u00e9p to\u00e1n ho\u1eb7c thao t\u00e1c tr\u00ean nhi\u1ec1u ph\u1ea7n t\u1eed.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Kh\u00f4ng c\u1ea7n c\u00e1c thu\u1ed9c t\u00ednh ho\u1eb7c ph\u01b0\u01a1ng th\u1ee9c \u0111\u1eb7c bi\u1ec7t m\u00e0 \u0111\u1ed1i t\u01b0\u1ee3ng (Object) cung c\u1ea5p.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">C\u1ea7n l\u01b0u tr\u1eef c\u00e1c gi\u00e1 tr\u1ecb c\u00f3 th\u1ec3 l\u00e0 s\u1ed1, chu\u1ed7i, ho\u1eb7c b\u1ea5t k\u1ef3 ki\u1ec3u d\u1eef li\u1ec7u n\u00e0o kh\u00e1c trong c\u00f9ng m\u1ed9t danh s\u00e1ch.\u00a0<\/span><\/li>\n<\/ul>\n<h3><b>S\u1ef1 kh\u00e1c nhau gi\u1eefa Array v\u00e0 Object<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Trong Javascript, s\u1ef1 kh\u00e1c nhau c\u01a1 b\u1ea3n gi\u1eefa Array v\u00e0 Object ch\u00ednh l\u00e0 c\u00e1ch th\u1ee9c t\u1ed5 ch\u1ee9c v\u00e0 kh\u1ea3 n\u0103ng truy c\u1eadp d\u1eef li\u1ec7u trong Array c\u0169ng nh\u01b0 Object. C\u1ee5 th\u1ec3:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Array:<\/b><span style=\"font-weight: 400;\"> Trong Javascript, Array \u0111\u01b0\u1ee3c d\u00f9ng nh\u01b0 m\u1ed9t c\u1ea5u tr\u00fac d\u1eef li\u1ec7u \u0111\u1ec3 l\u01b0u tr\u1eef c\u00e1c ph\u1ea7n t\u1eed. C\u00e1c ph\u1ea7n t\u1eed n\u00e0y \u0111\u01b0\u1ee3c truy c\u1eadp th\u00f4ng qua ch\u1ec9 s\u1ed1 (index) d\u1ea1ng s\u1ed1 b\u1eaft \u0111\u1ea7u t\u1eeb 0.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Object: <\/b><span style=\"font-weight: 400;\">M\u1ed9t c\u1ea5u tr\u00fac d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c d\u00f9ng \u0111\u1ec3 l\u01b0u tr\u1eef c\u00e1c c\u1eb7p key-value. Trong \u0111\u00f3, key th\u01b0\u1eddng l\u00e0 m\u1ed9t chu\u1ed7i (string) v\u00e0 value c\u00f3 th\u1ec3 l\u00e0 b\u1ea5t k\u1ef3 d\u1eef li\u1ec7u n\u00e0o.\u00a0<\/span><\/li>\n<\/ul>\n<h3><b>L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 bi\u1ebft m\u1ed9t bi\u1ebfn c\u00f3 ph\u1ea3i l\u00e0 Array kh\u00f4ng?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Ch\u1eb3ng h\u1ea1n nh\u01b0 \u0111o\u1ea1n m\u00e3 d\u01b0\u1edbi \u0111\u00e2y, khi s\u1eed d\u1ee5ng typeof, Javascript Operator s\u1ebd tr\u1ea3 v\u1ec1 k\u1ebft qu\u1ea3 l\u00e0 m\u1ed9t Object. V\u1eady \u0111\u1ec3 gi\u1ea3i quy\u1ebft v\u1ea5n \u0111\u1ec1 n\u00e0y, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng ph\u01b0\u01a1ng ph\u00e1p l\u00e0 Array.isArray(), c\u1ee5 th\u1ec3:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">&lt;!DOCTYPE html&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>html<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>body<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>h1<\/b><span style=\"font-weight: 400;\">&gt;<\/span><span style=\"font-weight: 400;\">JavaScript Arrays<\/span><span style=\"font-weight: 400;\">&lt;\/<\/span><b>h1<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>h2<\/b><span style=\"font-weight: 400;\">&gt;<\/span><span style=\"font-weight: 400;\">The isArray() Method<\/span><span style=\"font-weight: 400;\">&lt;\/<\/span><b>h2<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>p<\/b><span style=\"font-weight: 400;\"> id=<\/span><span style=\"font-weight: 400;\">\"demo\"<\/span><span style=\"font-weight: 400;\">&gt;&lt;\/<\/span><b>p<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>script<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">const<\/span><span style=\"font-weight: 400;\"> fruits = [<\/span><span style=\"font-weight: 400;\">\"Banana\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Orange\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"Apple\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n<span style=\"font-weight: 400;\">document<\/span><span style=\"font-weight: 400;\">.getElementById(<\/span><span style=\"font-weight: 400;\">\"demo\"<\/span><span style=\"font-weight: 400;\">).innerHTML = <\/span><span style=\"font-weight: 400;\">Array<\/span><span style=\"font-weight: 400;\">.isArray(fruits);<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>script<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>body<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>html<\/b><span style=\"font-weight: 400;\">&gt;<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Ngo\u00e0i ra, m\u1ed9t ph\u01b0\u01a1ng ph\u00e1p n\u1eefa b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng l\u00e0 instanceof tr\u1ea3 v\u1ec1 true n\u1ebfu m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng \u0111\u01b0\u1ee3c t\u1ea1o b\u1edfi m\u1ed9t h\u00e0m nh\u1ea5t \u0111\u1ecbnh. C\u1ee5 th\u1ec3:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">&lt;!DOCTYPE html&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>html<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>body<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>h1<\/b><span style=\"font-weight: 400;\">&gt;<\/span><span style=\"font-weight: 400;\">JavaScript Operators<\/span><span style=\"font-weight: 400;\">&lt;\/<\/span><b>h1<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>h2<\/b><span style=\"font-weight: 400;\">&gt;<\/span><span style=\"font-weight: 400;\">The instanceof Operator<\/span><span style=\"font-weight: 400;\">&lt;\/<\/span><b>h2<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>p<\/b><span style=\"font-weight: 400;\">&gt;<\/span><span style=\"font-weight: 400;\">The instanceof operator returns true if an object is an instance of a specified object type:<\/span><span style=\"font-weight: 400;\">&lt;\/<\/span><b>p<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>p<\/b><span style=\"font-weight: 400;\"> id=<\/span><span style=\"font-weight: 400;\">\"demo\"<\/span><span style=\"font-weight: 400;\">&gt;&lt;\/<\/span><b>p<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;<\/span><b>script<\/b><span style=\"font-weight: 400;\">&gt;<\/span> \r\n<span style=\"font-weight: 400;\">\/\/ Create an Array<\/span>\r\n<span style=\"font-weight: 400;\">const<\/span><span style=\"font-weight: 400;\"> fruits = [<\/span><span style=\"font-weight: 400;\">\"apples\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"bananas\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"oranges\"<\/span><span style=\"font-weight: 400;\">];<\/span>\r\n\r\n<span style=\"font-weight: 400;\">document<\/span><span style=\"font-weight: 400;\">.getElementById(<\/span><span style=\"font-weight: 400;\">\"demo\"<\/span><span style=\"font-weight: 400;\">).innerHTML =<\/span>\r\n<span style=\"font-weight: 400;\">\"Array: \"<\/span><span style=\"font-weight: 400;\"> + (fruits <\/span><span style=\"font-weight: 400;\">instanceof<\/span> <span style=\"font-weight: 400;\">Array<\/span><span style=\"font-weight: 400;\">);<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>script<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>body<\/b><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><b>html<\/b><span style=\"font-weight: 400;\">&gt;<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3 \u0111o\u1ea1n m\u00e3 tr\u00ean:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-77350\" src=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-4-vippro.jpg\" alt=\"array javascript - itviec blog\" width=\"885\" height=\"264\" srcset=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-4-vippro.jpg 885w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-4-vippro-300x89.jpg 300w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-4-vippro-700x209.jpg 640w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-4-vippro-200x60.jpg 200w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-4-vippro-100x30.jpg 100w\" sizes=\"auto, (max-width: 885px) 100vw, 885px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Tong_ket_ve_Array_Javascript\"><\/span><b>T\u1ed5ng k\u1ebft v\u1ec1 Array Javascript<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Nh\u01b0 v\u1eady, b\u00e0i vi\u1ebft \u0111\u00e3 gi\u1ea3i \u0111\u00e1p chi ti\u1ebft v\u1ec1 Array Javascript, m\u1ed9t trong nh\u1eefng c\u1ea5u tr\u00fac d\u1eef li\u1ec7u c\u01a1 b\u1ea3n trong Javascript. \u0110\u1ec3 n\u1eafm v\u1eefng h\u01a1n n\u1ec1n t\u1ea3ng ki\u1ebfn th\u1ee9c v\u1ec1 Javascript, h\u00e3y th\u1eed \u00e1p d\u1ee5ng ch\u00fang v\u00e0o nh\u1eefng d\u1ef1 \u00e1n th\u1ef1c t\u1ebf c\u0169ng nh\u01b0 c\u00f3 c\u01a1 h\u1ed9i t\u00ecm hi\u1ec3u nhi\u1ec1u h\u01a1n v\u1ec1 kh\u00e1i ni\u1ec7m n\u00e2ng cao.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">B\u1eb1ng c\u00e1ch n\u00e0y, b\u1ea1n s\u1ebd \u0111\u1ea1t \u0111\u01b0\u1ee3c nhi\u1ec1u c\u01a1 h\u1ed9i c\u0169ng nh\u01b0 th\u00e0nh t\u00edch n\u1ed5i b\u1eadt trong c\u00f4ng vi\u1ec7c, tr\u1edf th\u00e0nh Javascript Developer chuy\u00ean nghi\u1ec7p.<\/span><\/p>\n<blockquote><p><i>Xem th\u00eam:<\/i> <strong><a href=\"https:\/\/itviec.com\/blog\/javascript-developer\/\"><i>Javascript Developer l\u00e0 g\u00ec? C\u00e1c h\u01b0\u1edbng ph\u00e1t tri\u1ec3n c\u1ee7a Javascript Developer<\/i><\/a><\/strong><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Array Javascript l\u00e0 c\u1ea5u tr\u00fac d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 l\u01b0u tr\u1eef nhi\u1ec1u gi\u00e1 tr\u1ecb trong m\u1ed9t bi\u1ebfn duy nh\u1ea5t. Ch\u00fang c\u00f3 th\u1ec3 ch\u1ee9a nhi\u1ec1u ki\u1ec3u d\u1eef li\u1ec7u kh\u00e1c nhau v\u00e0 c\u00e1c ph\u1ea7n t\u1eed \u0111\u01b0\u1ee3c truy c\u1eadp theo ch\u1ec9 m\u1ee5c b\u1eaft \u0111\u1ea7u t\u1eeb 0. \u0110\u1ecdc b\u00e0i vi\u1ebft sau \u0111\u00e2y \u0111\u1ec3 \u0111\u01b0\u1ee3c gi\u1ea3i \u0111\u00e1p chi [&hellip;]<\/p>\n","protected":false},"author":207,"featured_media":77544,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_gspb_post_css":"","footnotes":""},"categories":[109],"tags":[],"class_list":["post-77299","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chuyen-mon-it"],"blocksy_meta":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v27.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Array JavaScript: T\u1ed5ng h\u1ee3p 12 ph\u01b0\u01a1ng th\u1ee9c quan tr\u1ecdng c\u1ee7a array - ITviec Blog<\/title>\n<meta name=\"description\" content=\"Array Javascript l\u00e0 m\u1ed9t trong nh\u1eefng c\u1ea5u tr\u00fac d\u1eef li\u1ec7u c\u01a1 b\u1ea3n c\u1ee7a JS. T\u00ecm hi\u1ec3u \u0111\u1ecbnh ngh\u0129a v\u1ec1 m\u1ea3ng v\u00e0 c\u00e1ch s\u1eed d\u1ee5ng chi ti\u1ebft trong b\u00e0i vi\u1ebft sau.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Array JavaScript: T\u1ed5ng h\u1ee3p 12 ph\u01b0\u01a1ng th\u1ee9c quan tr\u1ecdng c\u1ee7a array\" \/>\n<meta property=\"og:description\" content=\"Array Javascript l\u00e0 c\u1ea5u tr\u00fac d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 l\u01b0u tr\u1eef nhi\u1ec1u gi\u00e1 tr\u1ecb trong m\u1ed9t bi\u1ebfn duy nh\u1ea5t. Ch\u00fang c\u00f3 th\u1ec3 ch\u1ee9a nhi\u1ec1u ki\u1ec3u d\u1eef li\u1ec7u kh\u00e1c nhau v\u00e0 c\u00e1c\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/\" \/>\n<meta property=\"og:site_name\" content=\"ITviec Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ITviec\" \/>\n<meta property=\"article:published_time\" content=\"2024-08-29T09:53:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-vippro.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2850\" \/>\n\t<meta property=\"og:image:height\" content=\"1500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Uyen Ngo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ITviec\" \/>\n<meta name=\"twitter:site\" content=\"@ITviec\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"Uyen Ngo\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 ph\u00fat\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Array JavaScript: T\u1ed5ng h\u1ee3p 12 ph\u01b0\u01a1ng th\u1ee9c quan tr\u1ecdng c\u1ee7a array - ITviec Blog","description":"Array Javascript l\u00e0 m\u1ed9t trong nh\u1eefng c\u1ea5u tr\u00fac d\u1eef li\u1ec7u c\u01a1 b\u1ea3n c\u1ee7a JS. T\u00ecm hi\u1ec3u \u0111\u1ecbnh ngh\u0129a v\u1ec1 m\u1ea3ng v\u00e0 c\u00e1ch s\u1eed d\u1ee5ng chi ti\u1ebft trong b\u00e0i vi\u1ebft sau.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/","og_locale":"vi_VN","og_type":"article","og_title":"Array JavaScript: T\u1ed5ng h\u1ee3p 12 ph\u01b0\u01a1ng th\u1ee9c quan tr\u1ecdng c\u1ee7a array","og_description":"Array Javascript l\u00e0 c\u1ea5u tr\u00fac d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 l\u01b0u tr\u1eef nhi\u1ec1u gi\u00e1 tr\u1ecb trong m\u1ed9t bi\u1ebfn duy nh\u1ea5t. Ch\u00fang c\u00f3 th\u1ec3 ch\u1ee9a nhi\u1ec1u ki\u1ec3u d\u1eef li\u1ec7u kh\u00e1c nhau v\u00e0 c\u00e1c","og_url":"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/","og_site_name":"ITviec Blog","article_publisher":"https:\/\/www.facebook.com\/ITviec","article_published_time":"2024-08-29T09:53:56+00:00","og_image":[{"width":2850,"height":1500,"url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-vippro.png","type":"image\/png"}],"author":"Uyen Ngo","twitter_card":"summary_large_image","twitter_creator":"@ITviec","twitter_site":"@ITviec","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"Uyen Ngo","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"14 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/#article","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/"},"author":{"name":"Uyen Ngo","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/f4cd1226846e0258c664e170d3e52d20"},"headline":"Array JavaScript: T\u1ed5ng h\u1ee3p 12 ph\u01b0\u01a1ng th\u1ee9c quan tr\u1ecdng c\u1ee7a array","datePublished":"2024-08-29T09:53:56+00:00","mainEntityOfPage":{"@id":"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/"},"wordCount":3255,"publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"image":{"@id":"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-vippro.png","articleSection":["Chuy\u00ean m\u00f4n IT"],"inLanguage":"vi"},{"@type":"WebPage","@id":"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/","url":"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/","name":"Array JavaScript: T\u1ed5ng h\u1ee3p 12 ph\u01b0\u01a1ng th\u1ee9c quan tr\u1ecdng c\u1ee7a array - ITviec Blog","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/#primaryimage"},"image":{"@id":"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-vippro.png","datePublished":"2024-08-29T09:53:56+00:00","description":"Array Javascript l\u00e0 m\u1ed9t trong nh\u1eefng c\u1ea5u tr\u00fac d\u1eef li\u1ec7u c\u01a1 b\u1ea3n c\u1ee7a JS. T\u00ecm hi\u1ec3u \u0111\u1ecbnh ngh\u0129a v\u1ec1 m\u1ea3ng v\u00e0 c\u00e1ch s\u1eed d\u1ee5ng chi ti\u1ebft trong b\u00e0i vi\u1ebft sau.","breadcrumb":{"@id":"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itviec.com\/blog\/array-javascript-la-gi\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/#primaryimage","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-vippro.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/array-javascript-vippro.png","width":2850,"height":1500,"caption":"array javascript - itviec blog"},{"@type":"BreadcrumbList","@id":"https:\/\/itviec.com\/blog\/array-javascript-la-gi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Chuy\u00ean m\u00f4n IT","item":"https:\/\/itviec.com\/blog\/chuyen-mon-it\/"},{"@type":"ListItem","position":2,"name":"Array JavaScript: T\u1ed5ng h\u1ee3p 12 ph\u01b0\u01a1ng th\u1ee9c quan tr\u1ecdng c\u1ee7a array"}]},{"@type":"WebSite","@id":"https:\/\/itviec.com\/blog\/#website","url":"https:\/\/itviec.com\/blog\/","name":"ITviec Blog","description":"IT Jobs &amp; People in Vietnam","publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itviec.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/itviec.com\/blog\/#organization","name":"ITviec","url":"https:\/\/itviec.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","width":1800,"height":1800,"caption":"ITviec"},"image":{"@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ITviec","https:\/\/x.com\/ITviec","https:\/\/www.linkedin.com\/company\/itviec","https:\/\/www.youtube.com\/channel\/UCYthAQ3bcGr57M_ag5gHDvQ"]},{"@type":"Person","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/f4cd1226846e0258c664e170d3e52d20","name":"Uyen Ngo","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/ngo-thieu-my-uyen-author-e1709880420317-100x100.jpg","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/ngo-thieu-my-uyen-author-e1709880420317-100x100.jpg","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/ngo-thieu-my-uyen-author-e1709880420317-100x100.jpg","caption":"Uyen Ngo"},"url":"https:\/\/itviec.com\/blog\/author\/uyen-ngo\/"}]}},"_links":{"self":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/77299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/users\/207"}],"replies":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/comments?post=77299"}],"version-history":[{"count":0,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/77299\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media\/77544"}],"wp:attachment":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media?parent=77299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/categories?post=77299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/tags?post=77299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}