Write JavaScript to display Pascal's triangle in an HTML canvas.
- User
Write JavaScript to display Pascal's triangle in an HTML canvas.
Assistant
var canvas = document.getElementById("myCanvas"); var ctx = canvas.getContext('2d');
for(var i = 1; i <= 10; i++) { ctx.fillStyle = '#fff'; ctx.fillRect(0, 0, canvas.width, canvas.height);
codefor(var j = 1; j <= i; j++) { ctx.fillStyle = '#000'; ctx.fillRect(0, 0, i, 1); ctx.fillRect(0, i - j - 1, i, j); }}
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.