jeudi 11 avril 2019

different if statement method in javascript

trying to know the name of the if-statement method so i can learn it in c#

https://hackernoon.com/you-might-not-need-if-statements-a-better-approach-to-branching-logic-59b4f877697f

read about this new method in this website

const decisionTree = { title: 'Is the user signed in?', if: { true: { title: 'Is the user premium?', if: { true: { title: 'Show the support widget', }, false: { title: 'Show the tip of the day', }, }, }, false: { title: 'Has the user searched yet?', if: { true: { title: 'Which category are they in?', if: { singles: { title: 'Request ad for kittens. Was an ad available?', if: { true: { title: 'Display kittens ad', }, false: { title: 'Display main banner ad', }, }, }, wedding: { title: 'Request ad for nappies. Was an ad available?', if: { true: { title: 'Display nappies ad', }, false: { title: 'Display main banner ad', }, }, }, retirement: { title: 'Request ad for holiday. Was an ad available?', if: { true: { title: 'Display holiday ad', }, false: { title: 'Display main banner ad', }, }, }, default: { title: 'Display main banner ad', }, }, }, false: { title: 'Display main banner ad', }, }, }, }, };

Aucun commentaire:

Enregistrer un commentaire