How to Append Value to an Array from Input Text in Javascript

preview_player
Показать описание
In this video tutorial, you will learn how to append value to an array from input text in javascript. I hope you'll like the video and leave your feedback and suggestions for future video tutorials.

0:00 HTML
0:42 CSS
1:47 Javascript
Рекомендации по теме
Комментарии
Автор

i wanna hug youu. been on this for hours and you made it very easy

feliciatimmy
Автор

Hi finding this useful but not sure how you are doing the arrow, "let template = users.map(user ==>"? What is this and how do you actually create it? Thanks.

craigcorbett
Автор

Sorry to bother you again, but is there any sort of code you can add onto the end so that in saves the updated array so that when you refresh the page the list doesnt restart?

DIBLIC
Автор

Thanks so much, though one thing. When I run the code instead of saying the names inside the variables it just says ${user}. Here is my code :

let users = ['Mark', 'James', 'Jane', 'Mary'];

function addUsers() {
let template = users.map(user =>
= template;
}

addUsers();

let btnAdd =
let input =

btnAdd.addEventListener('click', () => {
users.push(input.value);
input.value = '';
addUsers();
});

DIBLIC