Skip to main content
added 117 characters in body
Source Link
givanse
  • 121
  • 4

My observations:

  1. Use let instead of var. You are already using let in some places, but a few need to be converted. For those that do not know the difference, let is one of the new features in ES2015 (ES6) and it respects block scopes in the same way as other programming languages.
  2. ~~
  3. I would use file scope constants for the strings "passenger" and "vehicle". Makes it easier in the future to do refactors. For example, at the top of the file const PASSENGER = 'passenger'
  4. Change this if (!(nearest === undefined)) to if (!!nearest), what you care about is if its a truthy value. The specificity of "not undefined" would allow other falsy values like 0, null, NaN, '', "", \``````
  5. If file scope constant were to be used and all the possible values are known, you could test for those specifically. Instead of if (!!nearest) you could if ([PASSENGER, VEHICLE].includes(nearest))

My observations:

  1. Use let instead of var. You are already using let in some places, but a few need to be converted. For those that do not know the difference, let is one of the new features in ES2015 (ES6) and it respects block scopes in the same way as other programming languages.
  2. ~~
  3. I would use file scope constants for the strings "passenger" and "vehicle". Makes it easier in the future to do refactors.
  4. Change this if (!(nearest === undefined)) to if (!!nearest), what you care about is if its a truthy value. The specificity of "not undefined" would allow other falsy values like 0, null, NaN, '', "", \``
  5. If file scope constant were to be used and all the possible values are known, you could test for those specifically. Instead of if (!!nearest) you could if ([PASSENGER, VEHICLE].includes(nearest))

My observations:

  1. Use let instead of var. You are already using let in some places, but a few need to be converted. For those that do not know the difference, let is one of the new features in ES2015 (ES6) and it respects block scopes in the same way as other programming languages.
  2. ~~
  3. I would use file scope constants for the strings "passenger" and "vehicle". Makes it easier in the future to do refactors. For example, at the top of the file const PASSENGER = 'passenger'
  4. Change this if (!(nearest === undefined)) to if (!!nearest), what you care about is if its a truthy value. The specificity of "not undefined" would allow other falsy values like 0, null, NaN, '', "", ````
  5. If file scope constant were to be used and all the possible values are known, you could test for those specifically. Instead of if (!!nearest) you could if ([PASSENGER, VEHICLE].includes(nearest))
added 117 characters in body
Source Link
givanse
  • 121
  • 4

My observations:

  1. Use let instead of var. You are already using let in some places, but a few need to be converted. For those that do not know the difference, let is one of the new features in ES2015 (ES6) and it respects block scopes in the same way as other programming languages.
  2. ~~
  3. I would use file scope constants for the strings "passenger" and "vehicle". Makes it easier in the future to do refactors.
  4. Change this if (!(nearest === undefined)) to if (!!nearest), what you care about is if its a truthy value. The specificity of "not undefined" would allow other falsy values like 0, null, NaN, '', "", \``
  5. If file scope constant were to be used and all the possible values are known, you could test for those specifically. Instead of if (!!nearest) you could if ([PASSENGER, VEHICLE].includes(nearest))

My observations:

  1. Use let instead of var. You are already using let in some places, but a few need to be converted. For those that do not know the difference, let is one of the new features in ES2015 (ES6) and it respects block scopes in the same way as other programming languages.
  2. ~~
  3. I would use file scope constants for the strings "passenger" and "vehicle"
  4. Change this if (!(nearest === undefined)) to if (!!nearest), what you care about is if its a truthy value. If file scope constant were to be used and all the possible values are known, you could test for those specifically.

My observations:

  1. Use let instead of var. You are already using let in some places, but a few need to be converted. For those that do not know the difference, let is one of the new features in ES2015 (ES6) and it respects block scopes in the same way as other programming languages.
  2. ~~
  3. I would use file scope constants for the strings "passenger" and "vehicle". Makes it easier in the future to do refactors.
  4. Change this if (!(nearest === undefined)) to if (!!nearest), what you care about is if its a truthy value. The specificity of "not undefined" would allow other falsy values like 0, null, NaN, '', "", \``
  5. If file scope constant were to be used and all the possible values are known, you could test for those specifically. Instead of if (!!nearest) you could if ([PASSENGER, VEHICLE].includes(nearest))
added 117 characters in body
Source Link
givanse
  • 121
  • 4

My observations:

  1. useUse let instead of var
  2. ~. You are already using ride[userTypelet will throwin some places, but a syntax error~few need to be converted. For those that do not know the difference, let is one of the new features in ES2015 (ES6) and it respects block scopes in the same way as other programming languages.
  3. ~~
  4. I would use file scope constants for the strings "passenger" and "vehicle"
  5. Change this if (!(nearest === undefined)) to if (!!nearest), what you care about is if its a truthy value. If file scope constant were to be used and all the possible values are known, you could test for those specifically.

My observations:

  1. use let instead of var
  2. ~ride[userType will throw a syntax error~
  3. I would use file scope constants for the strings "passenger" and "vehicle"
  4. Change this if (!(nearest === undefined)) to if (!!nearest), what you care about is if its a truthy value.

My observations:

  1. Use let instead of var. You are already using let in some places, but a few need to be converted. For those that do not know the difference, let is one of the new features in ES2015 (ES6) and it respects block scopes in the same way as other programming languages.
  2. ~~
  3. I would use file scope constants for the strings "passenger" and "vehicle"
  4. Change this if (!(nearest === undefined)) to if (!!nearest), what you care about is if its a truthy value. If file scope constant were to be used and all the possible values are known, you could test for those specifically.
added 2 characters in body
Source Link
givanse
  • 121
  • 4
Loading
Source Link
givanse
  • 121
  • 4
Loading