1 what is pseudo code
2 what does the $ mean
3 this doesnât make any sense. i just wanna know how eval works.
For #3, itâs easy. $ is used to indicate we are using, in this case, jQuery library and want to have jQuery functions on object weâre using it on.
As for #1, pseudocode, itâs as @mtf said, a code that can be written down and it would make sense to person reading it. So essentially, pseudocode is used to describe how some app should be functioning. Pseudocode is actually important because itâs good practice to design app before you start writing code. To read more about pseudocode, you can follow this guide, it has good set of rules with examples to help you understand how to write real good pseudocode.
And hardest is of course #2. I am a bit confused by a fact that you said youâre making a plugin that adds functions that makes JS easier to use, so like your own library, which is great project and good way to learn, but you should probably first read something about JS and coding styles. This is just a friendly advice if you want to make a living in development. If you want, I can recommend you some books, just message me.
And now to your question - âHow eval() works?â. Well I gave you a link which, if you opened it, has it explained:
The argument of the eval() function is a string. If the string represents an expression, eval() evaluates the expression. If the argument represents one or more JavaScript statements, eval() evaluates the statements.
So basically that is how eval()
works. You give it some expression, and it is evaluated. You want an example? Here it is on my codepen, made just for you. If you donât want to open it, here is code for test:
function test() {
console.log('This is just a test.');
}
console.log('eval() test incoming...');
eval('test()');
I strongly suggest you read the link about eval()
I provided first, because there is enough talk and examples there.
Also, as @mtf said few posts ago, DONâT use eval()
, especially if you donât know how it works and how it should be used. You should solve problem you posted in first post using function calls, there is no need for using anything else.