SlideShare a Scribd company logo
PERFORMANCE
ANALYSIS
IN MERGING
ARRAYS
let result = array1.concat(array2);
console.log(result); // [1 , 2 , 3 , 4, "a" , "b" , "c"]
let result = [...array1, ...array2]
console.log(result); // [1 , 2 , 3 , 4, "a" , "b" , "c"]
METHOD 1 - Using Concat() - 0.080ms
METHOD 2 - Using Spread Operator ... - 0.021ms
METHOD 3 - Using prototype.push() - 0.004ms
Array.prototype.push.apply(array1, array2);
console.log(array1); // [1 , 2 , 3 , 4, "a" , "b" , "c"]
// NOTE: the result is stored in 1st argument “array1”
let array1 = [1 , 2 , 3 , 4];
let array2 = ["a" , "b" , "c"];

More Related Content

More from Ideas2IT Technologies (20)

PDF
JS Testing Frameworks
Ideas2IT Technologies
 
PDF
Cool usage of Encoding and Decoding a URI in Javascript
Ideas2IT Technologies
 
PDF
Iterables and Iterators in JavaScript
Ideas2IT Technologies
 
PDF
String comparison in javascript
Ideas2IT Technologies
 
PDF
JavaScript symbols
Ideas2IT Technologies
 
PDF
Json.parse() in JavaScript
Ideas2IT Technologies
 
PDF
Bubble sort in Java Script
Ideas2IT Technologies
 
PDF
Nullish coalescing in JavaScript
Ideas2IT Technologies
 
PDF
Conditionally add keys in JavaScript
Ideas2IT Technologies
 
PDF
What is Big O in JavaScript - Part-1
Ideas2IT Technologies
 
PDF
Variable hoisting in JavaScript
Ideas2IT Technologies
 
PDF
Formidable ES6 spread operator in JavaScript
Ideas2IT Technologies
 
PDF
Logging in JavaScript - Part-5
Ideas2IT Technologies
 
PDF
Logging in JavaScript - Part-4
Ideas2IT Technologies
 
PDF
Logging in JavaScript - Part-3
Ideas2IT Technologies
 
PDF
Logging in JavaScript - part-2
Ideas2IT Technologies
 
PDF
Logging in JavaScript - part-1
Ideas2IT Technologies
 
PDF
Array vs set in JavaScript
Ideas2IT Technologies
 
PDF
Arguments Object in JavaScript
Ideas2IT Technologies
 
PDF
Pollyfills in JavaScript
Ideas2IT Technologies
 
JS Testing Frameworks
Ideas2IT Technologies
 
Cool usage of Encoding and Decoding a URI in Javascript
Ideas2IT Technologies
 
Iterables and Iterators in JavaScript
Ideas2IT Technologies
 
String comparison in javascript
Ideas2IT Technologies
 
JavaScript symbols
Ideas2IT Technologies
 
Json.parse() in JavaScript
Ideas2IT Technologies
 
Bubble sort in Java Script
Ideas2IT Technologies
 
Nullish coalescing in JavaScript
Ideas2IT Technologies
 
Conditionally add keys in JavaScript
Ideas2IT Technologies
 
What is Big O in JavaScript - Part-1
Ideas2IT Technologies
 
Variable hoisting in JavaScript
Ideas2IT Technologies
 
Formidable ES6 spread operator in JavaScript
Ideas2IT Technologies
 
Logging in JavaScript - Part-5
Ideas2IT Technologies
 
Logging in JavaScript - Part-4
Ideas2IT Technologies
 
Logging in JavaScript - Part-3
Ideas2IT Technologies
 
Logging in JavaScript - part-2
Ideas2IT Technologies
 
Logging in JavaScript - part-1
Ideas2IT Technologies
 
Array vs set in JavaScript
Ideas2IT Technologies
 
Arguments Object in JavaScript
Ideas2IT Technologies
 
Pollyfills in JavaScript
Ideas2IT Technologies
 

Recently uploaded (20)

PPTX
WYSIWYG Web Builder Crack 2025 – Free Download Full Version with License Key
HyperPc soft
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
PPTX
computer forensics encase emager app exp6 1.pptx
ssuser343e92
 
PDF
Difference Between Kubernetes and Docker .pdf
Kindlebit Solutions
 
PDF
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
 
PPTX
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
 
PDF
Dealing with JSON in the relational world
Andres Almiray
 
PDF
Continouous failure - Why do we make our lives hard?
Papp Krisztián
 
PPTX
Quality on Autopilot: Scaling Testing in Uyuni
Oscar Barrios Torrero
 
PDF
2025年 Linux 核心專題: 探討 sched_ext 及機器學習.pdf
Eric Chou
 
PDF
Transparency into Your Software’s True Reach
team-WIBU
 
PPTX
ManageIQ - Sprint 265 Review - Slide Deck
ManageIQ
 
PDF
WholeClear Split vCard Software for Split large vCard file
markwillsonmw004
 
PPTX
Android Notifications-A Guide to User-Facing Alerts in Android .pptx
Nabin Dhakal
 
PDF
65811_Introducing the Fusion AI Agent Studio (1).pdf
g6129590
 
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
PDF
From Chaos to Clarity: Mastering Analytics Governance in the Modern Enterprise
Wiiisdom
 
PDF
IObit Uninstaller Pro 14.3.1.8 Crack for Windows Latest
utfefguu
 
PDF
Code Once; Run Everywhere - A Beginner’s Journey with React Native
Hasitha Walpola
 
PPTX
IObit Driver Booster Pro 12.4-12.5 license keys 2025-2026
chaudhryakashoo065
 
WYSIWYG Web Builder Crack 2025 – Free Download Full Version with License Key
HyperPc soft
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
computer forensics encase emager app exp6 1.pptx
ssuser343e92
 
Difference Between Kubernetes and Docker .pdf
Kindlebit Solutions
 
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
 
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
 
Dealing with JSON in the relational world
Andres Almiray
 
Continouous failure - Why do we make our lives hard?
Papp Krisztián
 
Quality on Autopilot: Scaling Testing in Uyuni
Oscar Barrios Torrero
 
2025年 Linux 核心專題: 探討 sched_ext 及機器學習.pdf
Eric Chou
 
Transparency into Your Software’s True Reach
team-WIBU
 
ManageIQ - Sprint 265 Review - Slide Deck
ManageIQ
 
WholeClear Split vCard Software for Split large vCard file
markwillsonmw004
 
Android Notifications-A Guide to User-Facing Alerts in Android .pptx
Nabin Dhakal
 
65811_Introducing the Fusion AI Agent Studio (1).pdf
g6129590
 
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
From Chaos to Clarity: Mastering Analytics Governance in the Modern Enterprise
Wiiisdom
 
IObit Uninstaller Pro 14.3.1.8 Crack for Windows Latest
utfefguu
 
Code Once; Run Everywhere - A Beginner’s Journey with React Native
Hasitha Walpola
 
IObit Driver Booster Pro 12.4-12.5 license keys 2025-2026
chaudhryakashoo065
 
Ad

Performance analysis in merging arrays - JavaScript

  • 2. let result = array1.concat(array2); console.log(result); // [1 , 2 , 3 , 4, "a" , "b" , "c"] let result = [...array1, ...array2] console.log(result); // [1 , 2 , 3 , 4, "a" , "b" , "c"] METHOD 1 - Using Concat() - 0.080ms METHOD 2 - Using Spread Operator ... - 0.021ms METHOD 3 - Using prototype.push() - 0.004ms Array.prototype.push.apply(array1, array2); console.log(array1); // [1 , 2 , 3 , 4, "a" , "b" , "c"] // NOTE: the result is stored in 1st argument “array1” let array1 = [1 , 2 , 3 , 4]; let array2 = ["a" , "b" , "c"];