how to make a generic variable in javascript
class GenericNumber<T> {
zeroValue: T;
add: (x: T, y: T) => T;
}
let myGenericNumber = new GenericNumber<number>();
myGenericNumber.zeroValue = 0;
myGenericNumber.add = function(x, y) { return x + y; };
var x = 1;
var y = 1;
if (x == y) {
x = x + 1
}
Also in JavaScript:
- javascript resize event
- react router dom props.history is undefined
- mongoose save or update
- sequelize query result
- '@babel/plugin-proposal-class-properties' webpack
- jquery select plugin
- js remove li from ul
- Regular expression: Match everything after a particular word
- moment js date diff
- .join in javascript
- Update matched key values in two JavaScript objects
- how to remove spaces from strings javascript
- Find parent and child from array javascript
- extract string from text file javascript
- navigation reset
- js indexof string
- javascript convert int to float with 2 decimal places
- how to print to console javascript
- ajax vs rest
- inject firebase in angularjs
- date range filter in lodash for multiple day
- express delete image
- storybook react router
- round down js