Java if else loop not working : I am currently working on a interactive timeline page generated all in js, but this loop is making the page not work

<!-- begin snippet: js hide: false -->

<!-- language: lang-js -->

    	if (i = 0) {
    		console.log('magic');
    	} else if (i = 1) {
    		console.log('magic');
    	} else if (i = 2 ) {
    		console.log('magic');
    	} else if (i = 3) {
    		console.log('magic');
    	} else if (i = 4) {
    		console.log('magic');
    	} else if (i = 5) {
    		console.log('magic');
    	} else if (i = 6) {
    		console.log('magic');
    	} else if (i = 7) {
    		console.log('magic');
    	} else {
    		console.log('magic');
    	}

<!-- end snippet -->

