Earn While Learning Web3 Programming>> Start Here FREE!!!
EXERCISE: Read and Research Beyond This Course About Differences between JavaScript and Solidity:
i. Post 1 differences between JavaScript and Solidity in this forum:
(NOTE: please, don't repeat what has been posted and use the numbering.
For example if the last post answer was (5), yours should be (6) and so on.
This will help ensure we have helpful non repetitive collection of full list of differences between JavaScript and Solidity)
NOTE:
This Is An Exercise From Our FREE Smart Contract Development With Solidity For Beginners Course (If you have not enrolled yet, you can join the course totally for FREE).
(1) Variable Declaration:
Example 1:
JavaScript number variable is declared something like this:
var number = 1;
While the same number variable will be declared in Solidity as:
uint number = 1;
Another Example
Example 2:
JavaScript string variable is declared something like this:
var fullName = "Solomon Foskaay";
While the same string variable will be declared in Solidity as:
string fullName = "Solomon Foskaay";
Another Example
Example 3:
JavaScript negative number variable is declared something like this:
var negativeNumber = -25;
While the same negative number variable will be declared in Solidity as:
int negativeNumber = -25;
- JavaScript is a language that's iterpreted just-in-time. It is most famous for frontend applications and executed in the browser, but also used for backend applications such as NodeJS and Adobe Acrobat.
- Solidity is a high level language. It gets compiled (not interpreted) and usually deployed on Blockchains that understand the Ethereum Virtual Machine (EVM). Once the code is compiled and deployed it is running as Smart Contract and one can interact with it.
3. Javascript can run on web browsers but solidity cannot 4. Javascript is an untyped programming languague but solidity is a typed programming language. 5.Javascript files are saved on .Js extension while Solidity is saved on .sol extension