Skip to content

Tag: logic

How to make combination pattern like this

screenshoot here i need help how to combination 4 field be as in a picture using javascript Examples Field1 : [1,2] Field2 : [3,4] Field3 : [5,6] Field4 : [7,8] Result Output : 1357 * 1358 * 1367 * 1368 * 1457 * 1458 * 1467 * 1468 * 2357 * 2358 * 2367 * 2368 * 2457 * 2458

Print number patterns in JavaScript

I want to print numbers in pattern as below also I need this to print using only one for loop not in if condition inside for loop. If I give s = 7 the output pattern would be 7, 5, 3, 1, 3, 5, 7 If s=6 then output is 6, 4, 2, 4, 6 This is what I tried