Git Product home page Git Product logo

Comments (5)

denniskovshov avatar denniskovshov commented on July 19, 2024

In my opinion cName makes it only worse as encourages reader to use confusing parameter names. classArg would be ok. I don't see much benefit anyway.

from youmightnotneedjquery.

 avatar commented on July 19, 2024

The benefit would be to prevent readers from thinking that the className to the left of the += operator represents the same entity as the className to the right of +=. Different entities shouldn't be given the same name. The way this code example is written won't run.

The choice of cName comes from Mozilla Developer Network. I'm impartial to it specifically.

from youmightnotneedjquery.

denniskovshov avatar denniskovshov commented on July 19, 2024

@janaspage I understand the benefit. Actually, I'm using the code as such and it runs for me. I still think that cName is not an ideal name.

from youmightnotneedjquery.

 avatar commented on July 19, 2024

Sorry, I should be more specific. The code as written works only if the user replaces the last appearance of className with the string 'className', or if the user previously defines className to be a variable whose value is a string naming the desired class.

My suggestion is not to represent user variables with names that are identical to native property names or reserved keywords, as it potentially complicates debugging. Thanks for your consideration. Cheers.

from youmightnotneedjquery.

Abbondanzo avatar Abbondanzo commented on July 19, 2024

Going to keep them as-is for now

from youmightnotneedjquery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.