You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sandesh Kota edited this page May 28, 2019
·
4 revisions
array : indexer vs getvalue / setvale
int[] numbers = new int[]{1, 2, 3, 4};
var val1 = numbers.GetValue(3); // object
var val2 = numbers[3]; // integer
// When you are using Array class(with uppercase) there are no indexers
private void M(Array array)
{
array[0] = 5; // <-- Compiler error
array.SetValue(5, 0); // <-- Works
}
for-of v/s for-in | of v/s in
let names = [ 'sa', 'kota', 'ok' ];
for (let name of names) {
console.log(name);
}
// output: sa, kota, ok
for (let name in names) {
console.log(name);
}
// output: 0, 1, 2
javascript shortcut (+) to convert string to numeric