“sending ‘const NSString *’ to parameter of type ‘NSString *’ discards qualifiers” warning

You should declare your constant string as follows: NSString * const kSomeConstantString = @””; // constant pointer instead of: const NSString * kSomeConstantString = @””; // pointer to constant // equivalent to NSString const * kSomeConstantString = @””; The former is a constant pointer to an NSString object, while the latter is a pointer to … Read more

Why does JSHint throw a warning if I am using const?

When relying upon ECMAScript 6 features such as const, you should set this option so JSHint doesn’t raise unnecessary warnings. /*jshint esnext: true */ (Edit 2015.12.29: updated syntax to reflect @Olga’s comments) /*jshint esversion: 6 */ const Suites = { Spade: 1, Heart: 2, Diamond: 3, Club: 4 }; This option, as the name suggests, … Read more

Const in JavaScript: when to use it and is it necessary?

There are two aspects to your questions: what are the technical aspects of using const instead of var and what are the human-related aspects of doing so. The technical difference is significant. In compiled languages, a constant will be replaced at compile-time and its use will allow for other optimizations like dead code removal to … Read more

What is the difference between the “const” and “final” keywords in Dart?

There is a post on dart’s website and it explains it pretty well. Final: “final” means single-assignment: a final variable or field must have an initializer. Once assigned a value, a final variable’s value cannot be changed. final modifies variables. Const: “const” has a meaning that’s a bit more complex and subtle in Dart. const … Read more