100 JS Functions

Beginner

1. minutesToHours

2. averageOf4Numbers

3. concat3

4. max5

5. getMonthsNeededToWait

6. getGasolineAmount

7. lastNRevert

8. getBusinessAddress

9. getUserObject

10. canDriveCar

11. areAllNumbersEven

12. getBiggestNumberInArrays

13. getLongestString

14. everyNPositions

15. doubleNumbers

16. mostRepetitions

17. getMillisecondsBetween

18. getMonthOfTheYear

19. addDays

20. getDevelopers

21. extractElementsBetweenPositions

22. isSorted

23. halfAndHalf

24. isSameDay

25. getMaxMovingDistance

Intermediate

26. arrayToObject

27. pickFields

28. getHighestPaidEmployee

29. flipObject

30. diffArrays

31. countPageViews

32. linkedNumbersSum

33. getMissingContacts

34. removeFirstAndLast

35. biggestPowerOf2

36. areValuesUnique

37. fetchGitHubName

38. rotateArray

39. getDaysInMonth

40. formatDateTime

41. toDecimal

42. compareSets

43. groupBirthdays

44. diffReactions

45. rgbToHex

46. timeAgo

47. customArraySort

48. moveItems

49. isValidPassword

50. mergeSortedArrays

51. ascendingSplit

52. findUniqueNumber

53. parseQueryParams

54. simpleCompression

55. partitionArray

56. findFreeCalendarSpots

57. mergeIntervals

58. simpleURLParser

59. pickNested

60. fetchNamesOfAllPublicRepos

61. getPaginatedData

62. getCheckPassword

63. getAdd5

64. getAddN

65. fetchClosedPullRequests

66. fetchBranchNames

67. searchMessages

68. objectToMap

69. createQueue

70. createStack

71. isSameWeek

72. bfsTraversal

73. dfsTraversal

74. getDoubleN

75. deepCopy

Advanced

76. uniqBy

77. flow

78. createCounter

79. createPromise

80. reverseForEach

81. checkSettlesInTime

82. sorted

83. groupBy

84. createLinkedList

85. promiseOrder

86. isDeepEqual

87. delayResolve

88. classInheritance

89. customBind

90. todoList

91. reverseReduce

92. withCount

93. maxInvocations

94. createObservable

95. createPubSub

96. cacheGetResult

97. currySum

98. getCurry

99. throttle

100. debounce

44.diffReactions

Write a function named diffReactions that receives 2 parameters:

  • an Object representing the reactions a blog post had yesterday - yesterdayReactions
  • an Object representing the reactions that same blog post has today - todayReactions

Both parameters have the same structure:

  • each key represents the ID of a user
  • each value is an Array of strings, representing the reactions that user sent. Every reaction is one of the following: like, dislike, laugh, cry.

The function should return an Array of strings, describing what happened between yesterday and today. The strings should be in the following format:

  • <user_id> reacted with <reaction> if this user added a new reaction today
  • <user_id> removed their <reaction> if this user reacted yesterday but today removed that reaction

The order of the items in the returned Array is not important.

Example 1

Input

yesterdayReactions

=

todayReactions

=

Output

You'll see test results here!