K
K
konstantinst132021-03-22 15:40:46
Frontend
konstantinst13, 2021-03-22 15:40:46

How to change the string element of the array and push the changed version into the original array?

I have an initial array gridTemplateAreasArray which consists of one element.
The element has the following value: ""sources auto" "clicks auto" "shows auto" "conversion-price auto" "price auto" "conversion auto" "sales auto"".
I need to overwrite this array via JS so that it looks like:
0: ""sources auto" "clicks auto" "shows auto" "conversion-price auto" "price auto" "conversion auto" "sales auto"",
1: ""sources_twin_1 auto" "clicks_twin_1 auto" "shows_twin_1 auto" "conversion-price_twin_1 auto" "price_twin_1 auto" "conversion_twin_1 auto" "

const table = document.querySelector('.table'),
            tableArticles = document.querySelectorAll('.table__article');
      
      const gridTemplateAreas = window.getComputedStyle(table).gridTemplateAreas;
      const gridTemplateAreasArray = window.getComputedStyle(table).gridTemplateAreas.split();


How can I do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2018-03-01
@yuraSco

Easily searchable for "js before after"
https://github.com/jotform/before-after.js?files=1
www.catchmyfame.com/catchmyfame-jquery-plugins/jqu...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question