No if-else spaghetti and actually readable?
IntuitionKeep count of which number appears most. Then use that count to determine the type of triangle.ApproachStore each number as a key in a map and assign t
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Keep count of which number appears most. Then use that count to determine the type of triangle.

# Approach
<!-- Describe your approach to solving the problem. -->
Store each number as a key in a map and assign the number of times it appears to that key's value. If the value surpasses the current `count`, then we assign a new `count` using that value; giving us the max count.

# Complexity
- Time complexity: $$O(n)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: $$O(n)$$
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```javascript []
/**
 * @param {number[]} nums
 * @return {string}
 */
var triangleType = function(nums) {
    if (!isValid(nums)) return 'none'

    const map = {}
    let count = 0

    for (let num of nums) {
        map[num] = (map[num] || 0) + 1
        count = Math.max(count, map[num])
    }

    switch (count) {
        case 1: return 'scalene'
        case 2: return 'isosceles'
        case 3: return 'equilateral'
    }
};

var isValid = function(nums) {
    if (nums[0] + nums[1] <= nums[2]) return false
    if (nums[0] + nums[2] <= nums[1]) return false
    if (nums[1] + nums[2] <= nums[0]) return false

    return true
}
```
['JavaScript']