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"];
Ad

Recommended

Ch06 Stack
Ch06 Stack
leminhvuong
 
Matlab Rocket Simulation Project
Matlab Rocket Simulation Project
Michael Prokop
 
Matlab Simulation Appendix
Matlab Simulation Appendix
Michael Prokop
 
Working with exponents unit
Working with exponents unit
kwilkinson07
 
5431305001
5431305001
Poonsri Chaimongkol
 
simple linear regression
simple linear regression
Akhilesh Joshi
 
Version comaparison in JavaScript
Version comaparison in JavaScript
Ideas2IT Technologies
 
Currying in JavaScript
Currying in JavaScript
Ideas2IT Technologies
 
JS Testing Frameworks
JS Testing Frameworks
Ideas2IT Technologies
 
Cool usage of Encoding and Decoding a URI in Javascript
Cool usage of Encoding and Decoding a URI in Javascript
Ideas2IT Technologies
 
Iterables and Iterators in JavaScript
Iterables and Iterators in JavaScript
Ideas2IT Technologies
 
String comparison in javascript
String comparison in javascript
Ideas2IT Technologies
 
JavaScript symbols
JavaScript symbols
Ideas2IT Technologies
 
Json.parse() in JavaScript
Json.parse() in JavaScript
Ideas2IT Technologies
 
Bubble sort in Java Script
Bubble sort in Java Script
Ideas2IT Technologies
 
Nullish coalescing in JavaScript
Nullish coalescing in JavaScript
Ideas2IT Technologies
 
Conditionally add keys in JavaScript
Conditionally add keys in JavaScript
Ideas2IT Technologies
 
What is Big O in JavaScript - Part-1
What is Big O in JavaScript - Part-1
Ideas2IT Technologies
 
Variable hoisting in JavaScript
Variable hoisting in JavaScript
Ideas2IT Technologies
 
Formidable ES6 spread operator in JavaScript
Formidable ES6 spread operator in JavaScript
Ideas2IT Technologies
 
Logging in JavaScript - Part-5
Logging in JavaScript - Part-5
Ideas2IT Technologies
 
Logging in JavaScript - Part-4
Logging in JavaScript - Part-4
Ideas2IT Technologies
 
Logging in JavaScript - Part-3
Logging in JavaScript - Part-3
Ideas2IT Technologies
 
Logging in JavaScript - part-2
Logging in JavaScript - part-2
Ideas2IT Technologies
 
Logging in JavaScript - part-1
Logging in JavaScript - part-1
Ideas2IT Technologies
 
Array vs set in JavaScript
Array vs set in JavaScript
Ideas2IT Technologies
 
Arguments Object in JavaScript
Arguments Object in JavaScript
Ideas2IT Technologies
 
Pollyfills in JavaScript
Pollyfills in JavaScript
Ideas2IT Technologies
 
SAP Datasphere Catalog L2 (2024-02-07).pptx
SAP Datasphere Catalog L2 (2024-02-07).pptx
HimanshuSachdeva46
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 

More Related Content

More from Ideas2IT Technologies (20)

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

Recently uploaded (20)

SAP Datasphere Catalog L2 (2024-02-07).pptx
SAP Datasphere Catalog L2 (2024-02-07).pptx
HimanshuSachdeva46
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Making significant Software Architecture decisions
Making significant Software Architecture decisions
Bert Jan Schrijver
 
Rierino Commerce Platform - CMS Solution
Rierino Commerce Platform - CMS Solution
Rierino
 
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
BradBedford3
 
Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
What is data visualization and how data visualization tool can help.pptx
What is data visualization and how data visualization tool can help.pptx
Varsha Nayak
 
Open Source Software Development Methods
Open Source Software Development Methods
VICTOR MAESTRE RAMIREZ
 
Reimagining Software Development and DevOps with Agentic AI
Reimagining Software Development and DevOps with Agentic AI
Maxim Salnikov
 
Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)
VICTOR MAESTRE RAMIREZ
 
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
WSO2
 
How the US Navy Approaches DevSecOps with Raise 2.0
How the US Navy Approaches DevSecOps with Raise 2.0
Anchore
 
How to Choose the Right Web Development Agency.pdf
How to Choose the Right Web Development Agency.pdf
Creative Fosters
 
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
soulamaabdoulaye128
 
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
 
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
 
Transmission Media. (Computer Networks)
Transmission Media. (Computer Networks)
S Pranav (Deepu)
 
Insurance Underwriting Software Enhancing Accuracy and Efficiency
Insurance Underwriting Software Enhancing Accuracy and Efficiency
Insurance Tech Services
 
SAP Datasphere Catalog L2 (2024-02-07).pptx
SAP Datasphere Catalog L2 (2024-02-07).pptx
HimanshuSachdeva46
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Making significant Software Architecture decisions
Making significant Software Architecture decisions
Bert Jan Schrijver
 
Rierino Commerce Platform - CMS Solution
Rierino Commerce Platform - CMS Solution
Rierino
 
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
BradBedford3
 
Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
What is data visualization and how data visualization tool can help.pptx
What is data visualization and how data visualization tool can help.pptx
Varsha Nayak
 
Open Source Software Development Methods
Open Source Software Development Methods
VICTOR MAESTRE RAMIREZ
 
Reimagining Software Development and DevOps with Agentic AI
Reimagining Software Development and DevOps with Agentic AI
Maxim Salnikov
 
Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)
VICTOR MAESTRE RAMIREZ
 
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
WSO2
 
How the US Navy Approaches DevSecOps with Raise 2.0
How the US Navy Approaches DevSecOps with Raise 2.0
Anchore
 
How to Choose the Right Web Development Agency.pdf
How to Choose the Right Web Development Agency.pdf
Creative Fosters
 
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
soulamaabdoulaye128
 
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
 
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
 
Transmission Media. (Computer Networks)
Transmission Media. (Computer Networks)
S Pranav (Deepu)
 
Insurance Underwriting Software Enhancing Accuracy and Efficiency
Insurance Underwriting Software Enhancing Accuracy and Efficiency
Insurance Tech Services
 
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"];