Click here to Skip to main content
15,793,624 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am new developer in react. My question is
I need to copy authors array to authors1 changing field name .Can you please help me 

<pre lang="Javascript">const authors = [  
                'id': 1,   
                'name': 'Ranjeet',   
                'email': '@ranjeet'  
                'id': 2,   
                'name': 'Adil',   
                'email': '@adil'  

const authors1
                'authorId': 1,   
                'authorName': 'Ranjeet',   
                'authorEmail': '@ranjeet'  
                'authorId': 2,   
                'authorName': 'Adil',   
                'authorEmail': '@adil'  

What I have tried:

I tried to map array but it is not success. I searched in web I didn't find exact answer
Updated 11-Jul-22 23:11pm

1 solution

You won't find an exact answer to your question. A lot of programming is about finding a close-enough answer and adapting it to your requirements.

Use the method to map the elements in your array: - JavaScript | MDN[^]
const authors1 = => ({
    // Fill in the rest of the mapping here...
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900