JavaScript Journey

Cleared my basics from this site:

Made some beginner level codepens using only JS/HTML, no CSS so no expectations for good UI 😛

DOM specifications: 



#define and typedef

#define is a macro in C++ used as:

For example, `#define SIZE 100`,
Macro makes the replacements at the time of preprocessing, before compilation. All the values are put in expanded code before usual compilation starts.

typedef gives another name to a type and it is used as:
typedef TYPE NEW_TYPE;

Unlike #define it is interpreted by compiler and works as a new name for `TYPE`

See they are looking similiar, if I write #define TYPE int or typedef int INT what’s the difference here.

Difference: #define CHAR_PTR char* and typedef char* CHAR_PTR, lets take them one by one:

#define CHAR_PTR char*
CHAR_PTR a, b; //typeid(a).name = char* and typeid(b).name = char
               //because it is simply a replacement

typedef char* CHAR_PTR;
CHAR_PTR a,c; //typeid(a).name() = typeid(b).name = char*

Sources: StackOverflow, Let Us C, The C Programming Language -K&R