Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. C# vs. JavaScript/Typescript dyslexia

C# vs. JavaScript/Typescript dyslexia

Scheduled Pinned Locked Moved The Lounge
javascriptcsharpvisual-studiocom
25 Posts 16 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marc Clifton
    wrote on last edited by
    #1

    C#: var foo = "foo"; JS: let foo = "foo"; or: let foo = 'foo'; C#: var s = $"Foo = {foo}"; JS: let s = Foo = `${foo}`; C#: int Fnc(string a) TS: fnc(a: string): number C#: braces are on separate lines JS: opening brace is on the same line. C#: if (!String.IsNullOrEmpty(foo)) JS: if (foo) C#: Reverse(foo); JS: this.reverse(foo); or even worse: this.reverse(this.foo); Half the time I wrote the wrong syntax for the wrong language. :rolleyes:

    Latest Articles:
    Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions

    P Richard DeemingR R R M 10 Replies Last reply
    0
    • M Marc Clifton

      C#: var foo = "foo"; JS: let foo = "foo"; or: let foo = 'foo'; C#: var s = $"Foo = {foo}"; JS: let s = Foo = `${foo}`; C#: int Fnc(string a) TS: fnc(a: string): number C#: braces are on separate lines JS: opening brace is on the same line. C#: if (!String.IsNullOrEmpty(foo)) JS: if (foo) C#: Reverse(foo); JS: this.reverse(foo); or even worse: this.reverse(this.foo); Half the time I wrote the wrong syntax for the wrong language. :rolleyes:

      Latest Articles:
      Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      Do one language and do it well.

      L M 2 Replies Last reply
      0
      • M Marc Clifton

        C#: var foo = "foo"; JS: let foo = "foo"; or: let foo = 'foo'; C#: var s = $"Foo = {foo}"; JS: let s = Foo = `${foo}`; C#: int Fnc(string a) TS: fnc(a: string): number C#: braces are on separate lines JS: opening brace is on the same line. C#: if (!String.IsNullOrEmpty(foo)) JS: if (foo) C#: Reverse(foo); JS: this.reverse(foo); or even worse: this.reverse(this.foo); Half the time I wrote the wrong syntax for the wrong language. :rolleyes:

        Latest Articles:
        Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions

        Richard DeemingR Offline
        Richard DeemingR Offline
        Richard Deeming
        wrote on last edited by
        #3

        Marc Clifton wrote:

        JS: let s = Foo = `${foo}`;

        Or, if you get the quotes in the right place:

        let s = `Foo = ${foo}`;

        :)

        Marc Clifton wrote:

        C#: braces are on separate lines JS: opening brace is on the same line.

        Actually, in C#, braces can be on the same line, a different line, or whatever you call the abomination of a formatting style that @OriginalGriff prefers. :-D JS mostly doesn't care. It's only an issue with things like return { ... };, where putting the opening brace on a new line confuses the parser into thinking it's two statements with a missing semicolon after return.


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

        W M 2 Replies Last reply
        0
        • P PIEBALDconsult

          Do one language and do it well.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          PIEBALDconsult wrote:

          Do one language and do it well.

          If only I could. :(

          pkfoxP W 2 Replies Last reply
          0
          • L Lost User

            PIEBALDconsult wrote:

            Do one language and do it well.

            If only I could. :(

            pkfoxP Offline
            pkfoxP Offline
            pkfox
            wrote on last edited by
            #5

            With all your years of assembler I'm pretty sure you can :-D

            "I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP

            L 1 Reply Last reply
            0
            • L Lost User

              PIEBALDconsult wrote:

              Do one language and do it well.

              If only I could. :(

              W Offline
              W Offline
              W Balboos GHB
              wrote on last edited by
              #6

              Richard MacCutchan wrote:

              If only I could.

              (Obligatory Reply): Do you mean just 'do one language' or do you mean 'do it well'?

              Ravings en masse^

              "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

              "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

              1 Reply Last reply
              0
              • Richard DeemingR Richard Deeming

                Marc Clifton wrote:

                JS: let s = Foo = `${foo}`;

                Or, if you get the quotes in the right place:

                let s = `Foo = ${foo}`;

                :)

                Marc Clifton wrote:

                C#: braces are on separate lines JS: opening brace is on the same line.

                Actually, in C#, braces can be on the same line, a different line, or whatever you call the abomination of a formatting style that @OriginalGriff prefers. :-D JS mostly doesn't care. It's only an issue with things like return { ... };, where putting the opening brace on a new line confuses the parser into thinking it's two statements with a missing semicolon after return.


                "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                W Offline
                W Offline
                W Balboos GHB
                wrote on last edited by
                #7

                Aside from the opening brace belonging on the same line as functions, conditionals, &etc., which is a well established and eternal truth, I have a question: Using javaScript, I have never used 'let' to introduce a symbol declaration. I have used 'var'. Aside from some sort of visual distinction, does it serve any value.

                Ravings en masse^

                "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

                "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

                Richard DeemingR 1 Reply Last reply
                0
                • M Marc Clifton

                  C#: var foo = "foo"; JS: let foo = "foo"; or: let foo = 'foo'; C#: var s = $"Foo = {foo}"; JS: let s = Foo = `${foo}`; C#: int Fnc(string a) TS: fnc(a: string): number C#: braces are on separate lines JS: opening brace is on the same line. C#: if (!String.IsNullOrEmpty(foo)) JS: if (foo) C#: Reverse(foo); JS: this.reverse(foo); or even worse: this.reverse(this.foo); Half the time I wrote the wrong syntax for the wrong language. :rolleyes:

                  Latest Articles:
                  Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions

                  R Offline
                  R Offline
                  rnbergren
                  wrote on last edited by
                  #8

                  used to do this all the dang time. I don't write Javascript anymore unless I have too. hasn't happened in over a year! Yay me. But I switch between Powershell, SQL, C# etc... I sometimes forget how to comment in the language I am in at the time. It seems strange to me. I can write code quite well switching around. But I cannot remember how to comment in Powershell vs SQL vs C#. The Brain it is strange.

                  To err is human to really elephant it up you need a computer

                  J M 2 Replies Last reply
                  0
                  • W W Balboos GHB

                    Aside from the opening brace belonging on the same line as functions, conditionals, &etc., which is a well established and eternal truth, I have a question: Using javaScript, I have never used 'let' to introduce a symbol declaration. I have used 'var'. Aside from some sort of visual distinction, does it serve any value.

                    Ravings en masse^

                    "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

                    "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

                    Richard DeemingR Offline
                    Richard DeemingR Offline
                    Richard Deeming
                    wrote on last edited by
                    #9

                    Yes, variables declared using let[^] and const[^] behave differently to those declared using var. The MDN documentation does a pretty good job of explaining the difference. :)


                    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                    "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                    F 1 Reply Last reply
                    0
                    • pkfoxP pkfox

                      With all your years of assembler I'm pretty sure you can :-D

                      "I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      There was a time when i could write Univac assembler code with only minimal reference to the OS reference manual. Modern languages are now so feature rich you need the SDK reference almost every few lines. Or maybe I am just not very good at it.

                      pkfoxP S 2 Replies Last reply
                      0
                      • L Lost User

                        There was a time when i could write Univac assembler code with only minimal reference to the OS reference manual. Modern languages are now so feature rich you need the SDK reference almost every few lines. Or maybe I am just not very good at it.

                        pkfoxP Offline
                        pkfoxP Offline
                        pkfox
                        wrote on last edited by
                        #11

                        A find a blend of Google and Intellisense works for me - but yes, I take your point the framework is massive. Assembler is much more interesting to the likes of me though. :)

                        "I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP

                        1 Reply Last reply
                        0
                        • Richard DeemingR Richard Deeming

                          Yes, variables declared using let[^] and const[^] behave differently to those declared using var. The MDN documentation does a pretty good job of explaining the difference. :)


                          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                          F Offline
                          F Offline
                          Forogar
                          wrote on last edited by
                          #12

                          It's all about the scope.

                          - I would love to change the world, but they won’t give me the source code.

                          1 Reply Last reply
                          0
                          • R rnbergren

                            used to do this all the dang time. I don't write Javascript anymore unless I have too. hasn't happened in over a year! Yay me. But I switch between Powershell, SQL, C# etc... I sometimes forget how to comment in the language I am in at the time. It seems strange to me. I can write code quite well switching around. But I cannot remember how to comment in Powershell vs SQL vs C#. The Brain it is strange.

                            To err is human to really elephant it up you need a computer

                            J Offline
                            J Offline
                            jsc42
                            wrote on last edited by
                            #13

                            rnbergren wrote:

                            I sometimes forget how to comment in the language I am

                            Most folks I know don't know how to comment in any language; or, if they do know how, they don't use that ability.

                            R 1 Reply Last reply
                            0
                            • J jsc42

                              rnbergren wrote:

                              I sometimes forget how to comment in the language I am

                              Most folks I know don't know how to comment in any language; or, if they do know how, they don't use that ability.

                              R Offline
                              R Offline
                              rnbergren
                              wrote on last edited by
                              #14

                              Just like Turn Signals on Cars

                              To err is human to really elephant it up you need a computer

                              1 Reply Last reply
                              0
                              • P PIEBALDconsult

                                Do one language and do it well.

                                M Offline
                                M Offline
                                Marc Clifton
                                wrote on last edited by
                                #15

                                PIEBALDconsult wrote:

                                Do one language and do it well.

                                I can do both :) And both are continual "doing it better" experiences. That never ends, no matter how many years I've done development. Not only because of course the language features evolve.

                                Latest Articles:
                                Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions

                                1 Reply Last reply
                                0
                                • Richard DeemingR Richard Deeming

                                  Marc Clifton wrote:

                                  JS: let s = Foo = `${foo}`;

                                  Or, if you get the quotes in the right place:

                                  let s = `Foo = ${foo}`;

                                  :)

                                  Marc Clifton wrote:

                                  C#: braces are on separate lines JS: opening brace is on the same line.

                                  Actually, in C#, braces can be on the same line, a different line, or whatever you call the abomination of a formatting style that @OriginalGriff prefers. :-D JS mostly doesn't care. It's only an issue with things like return { ... };, where putting the opening brace on a new line confuses the parser into thinking it's two statements with a missing semicolon after return.


                                  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                                  M Offline
                                  M Offline
                                  Marc Clifton
                                  wrote on last edited by
                                  #16

                                  Richard Deeming wrote:

                                  Or, if you get the quotes in the right place:

                                  Oops. :-\

                                  Richard Deeming wrote:

                                  Actually, in C#, braces can be on the same line, a different line,

                                  Well yes, but ever since C++ I've used the separate line style.

                                  Richard Deeming wrote:

                                  JS mostly doesn't care. It's only an issue with things like return { ... };

                                  I believe return ({...}); also helps that? I know in some cases I have to put the object {} in parens so as not to confuse JS.

                                  Latest Articles:
                                  Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions

                                  1 Reply Last reply
                                  0
                                  • R rnbergren

                                    used to do this all the dang time. I don't write Javascript anymore unless I have too. hasn't happened in over a year! Yay me. But I switch between Powershell, SQL, C# etc... I sometimes forget how to comment in the language I am in at the time. It seems strange to me. I can write code quite well switching around. But I cannot remember how to comment in Powershell vs SQL vs C#. The Brain it is strange.

                                    To err is human to really elephant it up you need a computer

                                    M Offline
                                    M Offline
                                    Marc Clifton
                                    wrote on last edited by
                                    #17

                                    rnbergren wrote:

                                    I sometimes forget how to comment in the language

                                    Comments? What are those and when did that feature get introduced? ;)

                                    Latest Articles:
                                    Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions

                                    1 Reply Last reply
                                    0
                                    • M Marc Clifton

                                      C#: var foo = "foo"; JS: let foo = "foo"; or: let foo = 'foo'; C#: var s = $"Foo = {foo}"; JS: let s = Foo = `${foo}`; C#: int Fnc(string a) TS: fnc(a: string): number C#: braces are on separate lines JS: opening brace is on the same line. C#: if (!String.IsNullOrEmpty(foo)) JS: if (foo) C#: Reverse(foo); JS: this.reverse(foo); or even worse: this.reverse(this.foo); Half the time I wrote the wrong syntax for the wrong language. :rolleyes:

                                      Latest Articles:
                                      Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions

                                      R Offline
                                      R Offline
                                      raddevus
                                      wrote on last edited by
                                      #18

                                      This is a good post and I feel the same way about it. Also, don't you _HATE_ the backticks used in JS string interpolation? C# interpolation is actually nice and clean.

                                      1 Reply Last reply
                                      0
                                      • M Marc Clifton

                                        C#: var foo = "foo"; JS: let foo = "foo"; or: let foo = 'foo'; C#: var s = $"Foo = {foo}"; JS: let s = Foo = `${foo}`; C#: int Fnc(string a) TS: fnc(a: string): number C#: braces are on separate lines JS: opening brace is on the same line. C#: if (!String.IsNullOrEmpty(foo)) JS: if (foo) C#: Reverse(foo); JS: this.reverse(foo); or even worse: this.reverse(this.foo); Half the time I wrote the wrong syntax for the wrong language. :rolleyes:

                                        Latest Articles:
                                        Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions

                                        M Offline
                                        M Offline
                                        markrlondon
                                        wrote on last edited by
                                        #19

                                        Marc Clifton wrote:

                                        C# vs. JavaScript/Typescript dyslexia

                                        I find this in general. A great number of modern languages use the C/C++-style syntax and so differences can get confusing. Java, Kotlin, Rust, D, etc. all suffer from/contribute to it.

                                        1 Reply Last reply
                                        0
                                        • M Marc Clifton

                                          C#: var foo = "foo"; JS: let foo = "foo"; or: let foo = 'foo'; C#: var s = $"Foo = {foo}"; JS: let s = Foo = `${foo}`; C#: int Fnc(string a) TS: fnc(a: string): number C#: braces are on separate lines JS: opening brace is on the same line. C#: if (!String.IsNullOrEmpty(foo)) JS: if (foo) C#: Reverse(foo); JS: this.reverse(foo); or even worse: this.reverse(this.foo); Half the time I wrote the wrong syntax for the wrong language. :rolleyes:

                                          Latest Articles:
                                          Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions

                                          L Offline
                                          L Offline
                                          Lost User
                                          wrote on last edited by
                                          #20

                                          Marc Clifton wrote:

                                          Half the time I wrote the wrong syntax for the wrong language. :rolleyes:

                                          Don't write both.

                                          Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups