How to join two arrayss?

Mac Cruz
Mac Cruz used Ask the Experts™
on
How to join two const variables?

const p_data = [{type: 'text', value: 'Erwin', style: 'text-align:center;font-size:19px; font'}]
const s_data = [{type: 'text', value: 'John', style: 'text-align:center;font-size:14px;'}];
I tried this but it didn't work.. Any help please!
p_data += s_data
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Multitechnician
Top Expert 2014
Commented:
const like constant ?

const p_data = [{type: 'text', value: 'Erwin', style: 'text-align:center;font-size:19px; font'}]
const s_data = [{type: 'text', value: 'John', style: 'text-align:center;font-size:14px;'}];
p_data.push(s_data);

Open in new window

Capture-d-e-cran-2019-12-21-a--09.45.png

Author

Commented:
Thank you leakim971, its working.. I also used concat this would have the same result with the "push". Thank you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial