Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > CopperCube Open discussion
Javascript rubbish

Robo
Guest
Quote
2019-11-26 13:03:05

Sorry but have to get this off my chest from all the frustration in learning and using Javascript over the last few months:

Javascript is a total mess! - not kidding !

- What a stupid language that uses the symbol "+" to mean both mathematical addition as well as join together (ie strings) - causing endless confusion in broken code (yes I know there is a wok around).

- How silly that to join arguments together instead of using the obvious "and" you must use double "&&" instead.

- How silly to use "||" instead of the obvious "or"

- How damn silly that i can use ">=" or just ">" but cannot use "=" to compare values when I already have the word "if" in front of it so it should know to compare and not change a variable value...

many other silly things like this that unfortunately I am forced to deal with now that my game has progressed so far already...

there's my rant for that day....
thats my 2c worth...damn frustrating language if you ask me..


Robo
Guest
Quote
2019-11-26 20:51:11

Yet more silliness continues with Javascript:

I setup a variable with numerical value of 1.0
I then get the value above via 'ccbGetCopperCubeVariable' and add it to the value of another numerical variable and somehow javascript is unable to tell 1.0 is actually a number and instead thinks its a string and joins the 2 numbers together as text instead.....damn stupid if you ask me.

To fix this I have to add '*1' to the end of the variable lookup to confirm to poor javascript that yes this is actually a number not text....so silly.


erik
Registered User
Quote
2019-11-27 07:52:25

Yes, JavaScript has some silly properties.
But some of the things make sense, for example the operators (like || for or and && for and, the comparison operators >= etc), they are taken from other, popular languages. It's the same in C, C++, Java, CSharp, and similar.


Robo
Guest
Quote
2019-11-27 09:53:25

wrote:
Yes, JavaScript has some silly properties.
But some of the things make sense, for example the operators (like || for or and && for and, the comparison operators >= etc), they are taken from other, popular languages. It's the same in C, C++, Java, CSharp, and similar.



I spend many hours in frustration not realizing its not always my coding but the language itself....live an learn...


On the lighter side, even Javascript admits all this itself when you run this check whether Javascript is good code or not. It returns false and whether its better than rubbishscript - it tells me no...damn !

print("Javascript" < "Proper code"); ..true

print("Javascript" > "Rubbishscript"); ..false


carlosm
Registered User
Quote
2019-11-28 13:41:46

javascript is a fast uncompiling and powerful language.
all in javascript are objects. no end!
There are thousands of libraries for all sorts of things.

without javascript the internet would not be the same.


many engines use javascript coml language for programming .. even unity used for many years.

about the difficulties maybe if you study the fundamentals and syntax you will learn to better organize your code ..
and the use of "=", "==" many other programming languages is the same way. I do not know any programming language that does not use conditions. and almost all of them are like this .. (=, ===,! =, ==, +) in python in C the use of "+" also concatenates strings and variables.
Here is a site with great example and to learn a lot about javascript.

https://www.w3schools.com/js/

Other things that people do is repeat code when in fact we just need to crack a hook .. and use it several times by calling.


carlosm
Registered User
Quote
2019-11-28 13:46:41

Robo wrote:
Yet more silliness continues with Javascript:

I setup a variable with numerical value of 1.0
I then get the value above via 'ccbGetCopperCubeVariable' and add it to the value of another numerical variable and somehow javascript is unable to tell 1.0 is actually a number and instead thinks its a string and joins the 2 numbers together as text instead.....damn stupid if you ask me.

To fix this I have to add '*1' to the end of the variable lookup to confirm to poor javascript that yes this is actually a number not text....so silly.


>>>>>>
about this part do not understand.

In all programming languages there are types of variables .. for numeric values and words.
In javascript you determine the type of variable by its value.
Of course if I have a variable .. num1 = 1; and another num2 = 'now', if I want to display both I need to concatenate ..
in other languages they are like this.


Robo
Guest
Quote
2019-11-29 23:16:19

wrote:
Robo wrote:
Yet more silliness continues with Javascript:

I setup a variable with numerical value of 1.0
I then get the value above via 'ccbGetCopperCubeVariable' and add it to the value of another numerical variable and somehow javascript is unable to tell 1.0 is actually a number and instead thinks its a string and joins the 2 numbers together as text instead.....damn stupid if you ask me.

To fix this I have to add '*1' to the end of the variable lookup to confirm to poor javascript that yes this is actually a number not text....so silly.


>>>>>>
about this part do not understand.

In all programming languages there are types of variables .. for numeric values and words.
In javascript you determine the type of variable by its value.
Of course if I have a variable .. num1 = 1; and another num2 = 'now', if I want to display both I need to concatenate ..
in other languages they are like this.


Thanks for your input and javascript is not all bad - just parts of it.
By the way javascript doesnt know numbers versus strings as you have to specifically tell it using either (Number() or parseFloat() or parseInt () or multiply it by 1 or even just subtract a negative value of it. It tries to work it out and often gets it wrong by joining instead of adding 2 numbers together.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Inte?national" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact