You can generate a bitcoin wallet in many different ways, using bitcoin core client or using online wallet services or getting it from hardware wallet manufacturers etc.

What does a bitcoin wallet contains ?

It contains two keys private key, public key and a public address. The private key is used for spending your coins(i.e. signing a transaction) whereas the public key is used in verifying a signed transaction.
As public key is long it is shortened to create a address in a way that it becomes more readable, concise and less error prone while transacting.
So, Address is what you publish in public to receive bitcoins.

Flow Diagram courtesy bitcoin wiki
395px-PubKeyToAddr

How bitcoin wallet keys are generated ?

Steps:

  1. Generate a random number of length 32 bytes which will be called your private key.(Random number must be truly random or should be generated from cryptographically strong pseudo random number generator)
    af3e7bcc8f5be6b0ba3d568baeb52b2e2ef6c8d6f2608063976c9bcdbbd0ba83
  2. Apply ECDSA algorithm on private key derived from previous step to create a public key of length 65 bytes. 0x04 as prefix.
    047B8FDBF808E1F2015E2F61FE1565956C8EAE9715D1F0F9DD54F9D4114D1FA390F7070A689887D27A95C713F5219CE0D81EF4782662BDACD6730A96B47A444152

How bitcoin P2PKH address is derived from public key ?

Steps:

  1. Public key is hashed with SHA256 algorithm.
    5f0e78e99baed7e6297bd17494e2f80aa6fcf9dbd8a7e57b0522fb4ee85ca510
  2. Hash derived from previous step is hashed again with RIPMED-160 algorithm.
    5b17e6bb442cb0f1cd40d04c26a0ed10fc558e90
  3. Then, add bytes 00 as prefix to the hash derived from previous step.
    005b17e6bb442cb0f1cd40d04c26a0ed10fc558e90
  4. Hash received from previous step is again hashed with SHA256 algorithm two times sequentially to take out first four bytes from result as checksum.
    5970e23b87fbac16806d89960a4e3ca43c16ae6607546aa11797c38128b4f1e3
  5. Now these checksum bytes are added as suffix to output of step 3.
    005b17e6bb442cb0f1cd40d04c26a0ed10fc558e905970e23b
  6. Lastly we encode resultant bytes using Base58 notation to get a Bitcoin Address.
    19Jf89ZiPrau8NRi4ru7rWAFLRf2xBPjai

Javascript code to generate a Bitcoin P2PKH address

In a update to this blog, i'll we generating a bitcoin wallet using javascript.
stay tuned.

Update
Next Blog post link : https://blog.kherwa.com/2017/12/03/bitcoin-wallet-using-javascript/