a =["Ravi", "Ronak", "Tushar"]
const [f,...h]=a
console.log(f,{...h}) // Ravi { '0': 'Ronak', '1': 'Tushar' }
console.log(f,...h) // Ravi Ronak Tushar
console.log([f,...h]) // [ 'Ravi', 'Ronak', 'Tushar' ]
console.log(a.toString) // [Function: toString]
console.log(a.toString()) // Ravi,Ronak,Tushar
console.log((a.toString().split(",").reverse()).toString()) // Tushar,Ronak,Ravi
console.log((a.toString().split(",").reverse())) // [ 'Tushar', 'Ronak', 'Ravi' ]
const UserCard = ({ name, role, age, profilePic }) => {
return (
<div>
<p>Name: {name}</p>
<p>Role: {role}</p>
<p>Age: {age}</p>
<img src={profilePic} alt={name} />
</div>
)
}
function App() {
const user = {
name: "Ranjeet",
role: "WordPress Developer",
age: 27,
profilePic: "image.jpg",
}
return (
<div>
<UserCard {...user} />
</div>
)
}
export default App