Was following a tutorial on youtube but unfortunately didn't work. Any chance someone could tell me where I am going wrong?
let posts = [
  {name: '1', data: 'Hi1'},
  {name: '2', data: 'Hi2'},
]
function getPosts() {
  setTimeout(()=> {
    posts.forEach((post) => {
      console.log(post.name)
    })
  }, 1000)
}
function createPost(post) {
  setTimeout(()=> {
    posts.push(post)
  }, 2000)
  
} 
async function init() {
  await createPost({name: '3', data: 'hey'})
  getPosts()
}
init();
 
    