Beginner friendly JavaScript Solution
Time Complexity : O(n^2)\n\n/**\n * @param {number[]} nums\n * @param {number} k\n * @return {number}\n */\nvar countPairs = function(nums, k) {\n    var count 
**Time Complexity : O(n^2)**\n```\n/**\n * @param {number[]} nums\n * @param {number} k\n * @return {number}\n */\nvar countPairs = function(nums, k) {\n    var count = 0;\n    for(let i=0; i<nums.length; i++){\n        for(let j=i+1; j<nums.length; j++){\n            if(nums[i] == nums[j] && (i * j) % k == 0){\n                count++;\n            }\n        }\n    }\n    return count;\n};\n```
['JavaScript']