We're a place where coders share, stay up-to-date and grow their careers.
Swift:
func findOccurances(of numberToFind: Int, in listOfNumbers: [Int]) -> [Int] { return listOfNumbers.enumerated().compactMap { (index, number) in number == numberToFind ? index : nil } }
Swift: