Learn to code a JavaScript Random Name Generator

preview_player
Показать описание

Don’t forget to subscribe to the Junior Developer Central channel for more videos and tutorials!

This isn't the most complex or taxing of projects; we're simply going to take two arrays of first and last names and pick a random value from each to create a new random name.

If you're new to JavaScript however you'll find a couple of useful tips in here, particularly creating random numbers (and in turn to get a random value from an array) and also how to create JavaScript function that will be used to handle a button event click.

We'll finish off the tutorial with just a splash of styling by adding Bootstrap and a bit of CSS. Channel Handle @codebubb
Рекомендации по теме
Комментарии
Автор

Another question for you: how would you do this with images? I'm thinking of having 2 const categories and say, both images pull at the same time. Do you have any advice for going about that? And ty!

sunnysarthaven
Автор

Thank you for the tutorial.

EDIT: I figured it out!

sunnysarthaven
Автор

Subscribed! Great vid. Any chance you could talk through how to use data from a file or api like you mentioned at the end of the video? Been trying to figure it out for a while :)

roseninety
Автор

that's so cool! I just created my own painting ideas generator :) I was wondering if it's possible to add links to the results, and if so... how?

HeartmadeDesign
Автор

Hello, do you wrap the JS in <script> </script> and place in the <head> of an html doc? If, so I cannot seem to get it to work.

mdoyledesigns
Автор

HELLO! Ι would like to ask for your help. The Generator works perfect, but i want the two ''buckets'' of names (first second) to be the same but i dont wont the generator to pick the same name twice (like John John for example) what do i have to write in order to avoid that?

telefunkenguy
Автор

Awesome! Thank you. How about for example I have a 50 person and I want to get the 20% or 10% of random person?

janlawrencemadali
Автор

How do you style the random name generated?

neusvich
Автор

how would i get the code to send a specific message for a certain name/number?

aidendanu
Автор

Hi, how would I go about setting it up on a wordpress post?

johneebravo
Автор

What kind of program do you use to make this

Flipvb
Автор

Is there a way to make a bingo but if the word is used IT delete that word such as die(word)

youris
Автор

Thank you very much, is there somehow I can make only each name come out once and not be generated again? I'm using messages instead of names here, so it's just one string, I wanted each message to be viewed once only and not be repeated, how can I achieve that? thanks in advance

Zerikix
Автор

Is it possible to make 5, 000 random names?

TinaEarnings
Автор

Hey, I have typed all of the code. I think I messed something up in it or is this code outdated? Can you please send the Java Code in a comment?

TheOfficialBloxerYT
Автор

Wondering if anyone can help me? 
I am using Dreamweaver and literally copied the code from the CodePen link and I keep getting this error message on the first line of Javascript code: 
ERROR: parsing error the keyword 'const' is reserved

ellywhiley
Автор

Nice info ❤️ Thank you so much .. but how to create 10 random names at a one time plz help sir

DeepMalikReviews
Автор

hey man, it's not working for me it says there is a (Uncaught TypeError: Cannot read property 'addEventListener' of null) i have checked my code multiple times for a type error but i cant find any. need help!

karandhaliwal
Автор

Please help, it says
script.js:9 Uncaught TypeError: Cannot set property 'innerText' of null
at setRandomBackground

VLTNO
Автор

sir, I want to add here categories like for American names, there are different names and for French names, there are different names, I hope you understand me, Please tell I really want to know that.

violet
join shbcf.ru