Skip to content
Related Articles

Related Articles

SVG LineElement.y2 Property
  • Last Updated : 03 Nov, 2020

The SVG LineElement.y2 property returns an SVGAnimatedLength object corresponding to the attribute of the given line element

Syntax:

LineElement.y2

Return value: This property returns SVGAnimatedLength object that can be used to get the y2 of the line element

Example 1: 

HTML

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<body>
    <svg width="350" height="350" 
        xmlns="http://www.w3.org/2000/svg">
  
        <line x1="10" x2="100" y1="10" 
            y2="100" id="gfg" stroke="green" />
  
        <script>
            var g = document.getElementById("gfg");
            console.log(g.y2)
        </script>
    </svg>
</body>
  
</html>

chevron_right


Output:



Example 2: 

HTML

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<body>
    <svg width="350" height="350" 
        xmlns="http://www.w3.org/2000/svg">
  
        <line x1="10" x2="100" y1="10" 
            y2="150" id="gfg" stroke="green" />
  
        <script>
            var g = document.getElementById("gfg");
            console.log(g.y2)
        </script>
    </svg>
</body>
  
</html>

chevron_right


Output:

full-stack-img

My Personal Notes arrow_drop_up
Recommended Articles
Page :