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

PPT
Ch06 Stack
leminhvuong
 
PDF
Matlab Rocket Simulation Project
Michael Prokop
 
PDF
Matlab Simulation Appendix
Michael Prokop
 
PDF
Working with exponents unit
kwilkinson07
 
PDF
5431305001
Poonsri Chaimongkol
 
PPTX
simple linear regression
Akhilesh Joshi
 
PDF
Version comaparison in JavaScript
Ideas2IT Technologies
 
PDF
Currying in JavaScript
Ideas2IT Technologies
 
Ch06 Stack
leminhvuong
 
Matlab Rocket Simulation Project
Michael Prokop
 
Matlab Simulation Appendix
Michael Prokop
 
Working with exponents unit
kwilkinson07
 
simple linear regression
Akhilesh Joshi
 
Version comaparison in JavaScript
Ideas2IT Technologies
 
Currying in JavaScript
Ideas2IT Technologies
 

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
 
Ad

Recently uploaded (20)

PPT
Activate_Methodology_Summary presentatio
annapureddyn
 
PPTX
Explanation about Structures in C language.pptx
Veeral Rathod
 
PDF
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
PDF
Become an Agentblazer Champion Challenge Kickoff
Dele Amefo
 
PDF
Bandai Playdia The Book - David Glotz
BluePanther6
 
PDF
Micromaid: A simple Mermaid-like chart generator for Pharo
ESUG
 
PPTX
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
PPTX
Role Of Python In Programing Language.pptx
jaykoshti048
 
PDF
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
PDF
Exploring AI Agents in Process Industries
amoreira6
 
PDF
Become an Agentblazer Champion Challenge
Dele Amefo
 
PDF
49785682629390197565_LRN3014_Migrating_the_Beast.pdf
Abilash868456
 
PPTX
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
PPTX
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
PPTX
Odoo Integration Services by Candidroot Solutions
CandidRoot Solutions Private Limited
 
PPTX
Smart Panchayat Raj e-Governance App.pptx
Rohitnikam33
 
PPTX
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
PPTX
TestNG for Java Testing and Automation testing
ssuser0213cb
 
PPTX
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
PDF
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
Activate_Methodology_Summary presentatio
annapureddyn
 
Explanation about Structures in C language.pptx
Veeral Rathod
 
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
Become an Agentblazer Champion Challenge Kickoff
Dele Amefo
 
Bandai Playdia The Book - David Glotz
BluePanther6
 
Micromaid: A simple Mermaid-like chart generator for Pharo
ESUG
 
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
Role Of Python In Programing Language.pptx
jaykoshti048
 
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
Exploring AI Agents in Process Industries
amoreira6
 
Become an Agentblazer Champion Challenge
Dele Amefo
 
49785682629390197565_LRN3014_Migrating_the_Beast.pdf
Abilash868456
 
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
Odoo Integration Services by Candidroot Solutions
CandidRoot Solutions Private Limited
 
Smart Panchayat Raj e-Governance App.pptx
Rohitnikam33
 
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
TestNG for Java Testing and Automation testing
ssuser0213cb
 
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
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"];