JSFiddle - React, Tailwind, and code Playground

by Mark Ulybkin

HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Заголовок страницы</title>
		
	</head>
	<body>
	
	<script>


var list = {
	  value: 1,
	  next: {
	    value: 2,
	    next: {
	      value: 3,
	      next: {
	        value: 4,
	        next: null
	      }
	    }
	  }
	};


	/*function printList(list) {
		var std = list;

		do{
			console.log(std.value);
			std = std.next;
		} while(std != null)

	}

	printList(list);*/
	
/*	function printList(list) {
		var std = list;

		if(std != null) {
			console.log(std.value);
			std = printList(list.next);
		}

	}

	printList(list);*/



	/*function printReverseList(list) {
		var std = list;
		var arr = [];
		
		do {
			
			arr.push(std.value);
			std = std.next;

			// console.log(std.value - 1);
			
		} while(std != null)
		
		for (var i=arr.length; i>=0 ; i--) {
			console.log(arr[i]);
		}	
	}

	printReverseList(list);


	



	function printReverseList(list) {
		var std = list;
		var arr = [];

		if(std != null) {
			arr.push(std.value);
			std = printReverseList(list.next);
			
		}
		alert(arr);
	}

	printReverseList(list);



	</script>


	</body>
</html>