Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?Q?Joshua_Cranmer_=f0=9f=90=a7?= Newsgroups: comp.lang.javascript,comp.lang.java.programmer Subject: Re: questions re Javascript Date: Fri, 4 Sep 2015 10:09:01 -0500 Organization: A noiseless patient Spider Lines: 30 Message-ID: References: <2b531f48-fff9-4c73-a116-22a3f110e919@googlegroups.com> <020920150828500988%timstreater@greenbee.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 4 Sep 2015 15:07:27 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="8cedddb29338592f734c41b16a68fadc"; logging-data="11052"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+0pTFdSOMos+PHjkvIwTRRhs3aCu8rJoc=" User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:40.0) Gecko/20100101 Thunderbird/40.0 In-Reply-To: Cancel-Lock: sha1:fktLOR+nzbyIuCvmmxLWVoWsc+w= Xref: csiph.com comp.lang.javascript:28629 comp.lang.java.programmer:32521 On 9/2/2015 6:20 AM, Stefan Ram wrote: > There are so many similiarities between the two languages, > that I can't name them all. Really? I can: * Java and JS share the same core C-ish syntax (but not necessarily semantics) for expressions and statements. * They both use a strictly-defined evaluation order instead of C's undefined evaluation order. * A few method names (e.g., toString, or Math.sin) are the same. * The JS Date object is explicitly modelled on Java's Date object (unfortunately). * Their names start with the same first four letters. That's really about it. Java and JS use hugely different internal representations, and the semantics are often vastly different. Most notably, JS has no integers, only IEEE754 doubles, and the == operator in Java corresponds to === in JS where == in JS is .equals() in Java. For my part, calling the languages similar when semantics are so different does a disservice to neophytes attempting to learn one or the other. It's like saying English and French are similar, because they share the same grammatical constructs and many words are cognates. Peut-être il est vrai, mais on ne peut pas converser avec un autre sans apprendre à parler l'autre langue. -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth